I am trying to understand which ODBC functions to call and how to call them in order to fetch rows in batches or insert rows in batches ( inserts that use bind variables not just an array of insert statements ).
I can fetch one row at a time by calling these functions in order
SQLBindParameter
SQLExecute
SQLFetch
Also if doing inserts / updates I can do one row at a time by calling these functions
SQLBindParameter
SQLExecute
What I don't know is what I need to change in these calls in order to:
1) Fetch rows in batches e.g. 150 rows per batch
2) Insert several rows per SQLExcecute call e.g. 150 rows per call
Short contained examples ( not necessarily compilable since ODBC progs tend to be long .. so ignore setup/initialization, ignore error checking ) demonstrating how this is done would be helpful. Or a pointer to a comprehensible open source code that is doing this sort of thing
The following article tells you how to send rows of parameters in one go:
http://www.easysoft.com/products/data_access/odbc_odbc_bridge/performance_white_paper.html#3_1_2
Basically, you need to search for SQLSetStmtAttr and SQL_ATTR_PARAMSET_SIZE.
To fetch multiple rows in one go see http://www.easysoft.com/developer/languages/c/odbc-tutorial-fetching-results.html
Search for SQL_ATTR_ROW_ARRAY_SIZE.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With