Share via


Record Field Exchange: Using the RFX Functions

OverviewHow Do IFAQSampleODBC Driver List

This article explains how to use the RFX function calls that make up the body of your DoFieldExchange override.

****Note   ****This article applies to classes derived from in which bulk row fetching has not been implemented. If you are using bulk row fetching, then bulk record field exchange (Bulk RFX) is implemented. Bulk RFX is similar to RFX. To understand the differences, see the article Recordset: Fetching Records in Bulk (ODBC).

The RFX global functions exchange data between columns on the data source and field data members in your recordset. Normally you use ClassWizard to write the RFX function calls in your recordset’s member function. This article describes the functions briefly and shows the data types for which RFX functions are available. describes how to write your own RFX functions for additional data types.

RFX Function Syntax

Each RFX function takes three parameters (and some take an optional fourth or fifth parameter):

  • A pointer to a object. You simply pass along the pFX pointer passed to DoFieldExchange.

  • The name of the column as it appears on the data source.

  • The name of the corresponding field data member or parameter data member in the recordset class.

  • (Optional) In some of the functions, the maximum length of the string or array being transferred. This defaults to 255 bytes, but you might want to change it. The maximum size is based on the maximum size of a CString object — INT_MAX (2,147,483,647) bytes — but you will probably encounter driver limits before that size.

  • (Optional) In the RFX_Text function, you sometimes use a fifth parameter to specify the data type of a column.

For more information, see the RFX functions under in the Class Library Reference. For an example of when you might make special use of the parameters, see the article Recordset: Obtaining SUMs and Other Aggregate Results (ODBC).

RFX Data Types

The class library supplies RFX functions for transferring many different data types between the data source and your recordsets. The following list summarizes the RFX functions by data type. In cases where you must write your own RFX function calls, select from these functions by data type.

Function Data Type
RFX_Bool BOOL
RFX_Byte BYTE
RFX_Binary CByteArray
RFX_Double double
RFX_Single float
RFX_Int int
RFX_Long long
RFX_LongBinary CLongBinary
RFX_Text CString
RFX_Date CTime

For more information, see the RFX function documentation under in the Class Library Reference. For information about how C++ data types map to SQL data types, see the table ANSI SQL Data Types Mapped to C++ Data Types in the article SQL: SQL and C++ Data Types (ODBC).

See Also   Record Field Exchange: How RFX Works, Recordset: Parameterizing a Recordset (ODBC), Recordset: Dynamically Binding Data Columns (ODBC), ,