The example code in this section shows utility functions to which the DataDirect functions for bulk exporting, verification, and bulk loading refer, as well as the DataDirect functions GetBulkDiagRec and GetBulkDiagRecW.
SQLSMALLINT BufferLength,
SQLSMALLINT* TextLength);
SQLSMALLINT BufferLength,
SQLSMALLINT* TextLength);
The standard ODBC return codes are returned: SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_INVALID_HANDLE, SQL_NO_DATA, and SQL_ERROR.
GetBulkDiagRec (ANSI application) and GetBulkDiagRecW (Unicode application) return errors and warnings generated by bulk operations. The argument definition, return values, and function behavior is the same as for the standard ODBC SQLGetDiagRec and SQLGetDiagRecW functions with the following exceptions:
return GetProcAddress (hmod, name);
void *routine = shl_findsym (hmod, name);
shl_findsym (hmod, name, TYPE_PROCEDURE, &routine);
return dlsym (hmod, name);
UCHAR errmsg[SQL_MAX_MESSAGE_LENGTH * 2];
PGetBulkDiagRec getBulkDiagRec;
getBulkDiagRec = (PGetBulkDiagRec)
resolveName (hmod, "GetBulkDiagRec");
printf ("Cannot find GetBulkDiagRec!\n");
loop: rc = (*getBulkDiagRec) (SQL_HANDLE_DBC,
sqlstate, &nativeerr, errmsg,
SQL_MAX_MESSAGE_LENGTH - 1, &actualmsglen);
printf ("GetBulkDiagRec failed!\n");
if (rc == SQL_NO_DATA_FOUND) return;
printf ("SQLSTATE = %s\n", sqlstate);
printf ("NATIVE ERROR = %d\n", nativeerr);
errmsg[actualmsglen] = '\0';
printf ("MSG = %s\n\n", errmsg);