You can export data from a database in one of three ways:
From a table by using the driver Setup dialog
From a table by using DataDirect functions
From a result set by using DataDirect statement attributes
From the DataDirect driver Setup dialog, select the Bulk tab and click Export Table. See the driver configuration chapter for a description of this procedure.
Your application can export a table using the DataDirect functions ExportTableToFile (ANSI application) or ExportTableToFileW (Unicode application). The application must first obtain driver connection handles and function pointers, as shown in the following example:
Your application can export a result set using the DataDirect statement attributes SQL_BULK_EXPORT and SQL_BULK_EXPORT_PARAMS.
The export operation creates a bulk load data file with a .csv extension in which the exported data is stored. For example, assume that a source table named GBMAXTABLE contains four columns. The resulting bulk load data file GBMAXTABLE.csv containing the results of a query would be similar to the following:
A bulk load configuration file with and .xml extension is also created when either a table or a result set is exported to a bulk load data file. See "The Bulk Load Configuration File" for an example of a bulk load configuration file.
In addition, a log file of events as well as external overflow files can be created during a bulk export operation. The log file is configured through either the driver Setup dialog Bulk tab, the ExportTableToFile function, or the SQL_BULK_EXPORT statement attribute. The external overflow files are configured through connection options; see "External Overflow Files" for details.