ODBC: Microsoft ODBC Database Interface
Index: Requirements
Problems Companies
Platforms Languages
Software Research
- Object oriented interface to different databases, part of Win32.
- SQL server, Microsoft Access, foxpro, excel, dbase, paradox, text
files.
- Microsoft Foundation Class abstractions on
top of ODBC API.
- Insulates you from ODBC directly, presents another model. Based on
the design of DAO model, used in Microsoft Access
and Visual Basic.
- Microsoft prefers you use their newer MFC based
DAO Database Access Objects.
- RFX: Record Field Exchange Architecture
- Two way transfer of data between database columns and C++ object
data members, used with ODBC database classes.
- RFX is similar to the DFX mechanism in DAO.
- Custom RFX routines
- User extension mechanism capabilities:
- Add new data types, for example, CBookmark.
- Add new exchange procedures (RFX_???), for example, RFX_Bigint.
- Have the DoFieldExchange member function conditionally include
additional RFX calls or any other valid C++ statements.
- CMySet::DoFieldExchange(CFieldExchange *pFX)
- The DoFieldExchange func is much like Serialize. It gets or
sets data to or from external form (columns from the result of an ODBC query)
from/to member data in the class. The pFX parameter is the context from
doing data exchange and is similar to the CArchive parameter to CObject::Serialize.
The pFX (a CFieldExchange object) has an operation indicator, which is similar
to, but a generalization of the CArchive direction flag. An RFX function
may have to support the following operation:
- BindParam, BindFieldToColumn, Fixup, MarkForAddNew, MarkForUpdate,
Name, NameValue, SetFieldDirty, SetFieldNull, IsFieldDirty, IsFieldNull,
IsFieldNullable, StoreField, LoadField, GetFieldInfoValue, GetFieldInforOrdinal
- Recordset field calls are a way of registering memory locations
(usually data members) to store field data for a CMySet class.
- afxdb.h has a list of all the recordset field exchange routines
provided with MFC.
- Recordset exchange field type call:
- pFX->SetFieldType(CFieldExchange::outputColumn);
- Each RFX_ function must support various operations, ranging
from returning the dirty status of the field to archiving the field in preparation
for editing the field.
- Predefined RFX functions:
- RFX_LONG, RFX_Int, RFX_Single, RFX_Double, RFX_Text, RFX_Binary,
RFX_Date, RFX_LongBinary
- Recordset exchange function call:
- RFX_Custom(pFX, "Col2", m_Col2);