This example illustrates using ODBC bound columns to retrieve information faster.
Query Tool A makes the following ODBC calls to process SELECT statements:
SQLExecDirect("SELECT * FROM table_name") WHILE there_are_rows_to_fetch DO SQLFetch() FOR every_column DO SQLGetData( COLn ) END FOR ...process the data END WHILE
This tool does not make use of ODBC bound columns, which can help performance. A faster way to process this is as follows:
SQLExecDirect("SELECT * FROM table_name") FOR every_column DO SQLBindColumn( COLn ) END FOR WHILE there_are_rows_to_fetch DO SQLFetch() ...process the data END WHILE
If a table contained one column, there would be little difference between the two approaches. But for a table with a 100 columns, you end up with 100 times as many ODBC calls in the first example, for every row fetched. You also can optimize the second scenario because the target data types specified by the tool will not change from one FETCH to the next, like they could change with each SQLGetData call.