This documentation is archived and is not being maintained.


Transfers multiple rows of character data from a column of an ODBC data source to a corresponding array in a CRecordset-derived object.

void RFX_Text_Bulk(
   CFieldExchange* pFX,
   LPCTSTR szName,
   LPSTR* prgStrVals,
   long** prgLengths,
   int nMaxLength 


A pointer to a CFieldExchange object. This object contains information to define the context for each call of the function. For more information, see the article Record Field Exchange: How RFX Works.
The name of a data column.
A pointer to an array of LPSTR values. This array will store the data to be transferred from the data source to the recordset. Note that with the current version of ODBC, these values cannot be Unicode.
A pointer to an array of long integers. This array will store the length in bytes of each value in the array pointed to by prgStrVals. This length excludes the null termination character. Note that the value SQL_NULL_DATA will be stored if the corresponding data item contains a Null value. For more details, see the ODBC API function SQLBindCol in the ODBC SDK Programmer's Reference.
The maximum allowed length of the values stored in the array pointed to by prgStrVals, including the null termination character. To ensure that data will not be truncated, pass a value large enough to accommodate the largest data item you expect.


The data source column can have an ODBC type of SQL_LONGVARCHAR, SQL_CHAR, SQL_VARCHAR, SQL_DECIMAL, or SQL_NUMERIC. The recordset must define a field data member of type LPSTR.

If you initialize prgStrVals and prgLengths to NULL, then the arrays they point to will be allocated automatically, with sizes equal to the rowset size.

Note   Bulk record field exchange only transfers data from the data source to the recordset object. To make your recordset updateable, you must use the ODBC API function SQLSetPos. For an example of how to do this, see the sample DBFETCH.

For more information, see the articles Recordset: Fetching Records in Bulk (ODBC) and Record Field Exchange (RFX).


You must manually write calls in your DoBulkFieldExchange override. This example shows a call to RFX_Text_Bulk, as well as a call to RFX_Long_Bulk, for data transfer. These calls are preceded by a call to CFieldExchange::SetFieldType. Note that for parameters, you must call the RFX functions instead of the Bulk RFX functions.

void MultiRowSet::DoBulkFieldExchange( CFieldExchange* pFX )
   pFX->SetFieldType( CFieldExchange::outputColumn );
   RFX_Long_Bulk( pFX, _T( "[colRecID]" ),
                  &m_rgID, &m_rgIDLenghts );
   RFX_Text_Bulk( pFX, _T( "[colName]" ),
                  &m_rgName, &m_rgNameLengths, 30 );

   pFX->SetFieldType( CFieldExchange::inputParam );
   RFX_Text( pFX, "NameParam", m_strNameParam );

See Also

MFC Macros and Globals | RFX_Binary_Bulk | RFX_Bool_Bulk | RFX_Byte_Bulk | RFX_Date_Bulk | RFX_Double_Bulk | RFX_Int_Bulk | RFX_Long_Bulk | RFX_Single_Bulk | CFieldExchange::SetFieldType