Updated on 2025-09-04 GMT+08:00

Typical Issues

  1. Question: After setting ignoreCount (which specifies the data size to exclude), can I select which specific data to exclude from the database?

    Answer: Sure. In Complete Example, you can adjust the operator pointer operptr to specify which data should be inserted and which should be excluded. Specifically, when operptr is set to SQL_PARAM_IGNORE, the data will be excluded; when operptr is set to SQL_PARAM_PROCEED, the data will be inserted.

  2. Question: If batch insertion fails, can the transaction be committed for successfully inserted data and rolled back only for data that encounters an error?

    Answer: No, but in the event of insertion failure, the transaction must be rolled back for all scheduled data. However, to address the issue, one possible solution is to define smaller data batches in the application code to commit the data in batches for better exception capture.

  3. Question: I have set UseServerSidePrepare to 0 and inserted n records in batches, but why does the SQLRowCount API return 1 as the number of inserted records?

    Answer: This result is as expected. Let's revisit the explanation of UseServerSidePrepare provided in Preparations for the odbc.ini file for Linux environments: When UseServerSidePrepare is set to 1, PU/PBE packets will be sent for soft parsing. In this case, SQLRowCount returns the number of records updated last time. Conversely, when UseServerSidePrepare is set to 0, Q packets will be sent for hard parsing, where SQLRowCount still returns the number of records updated last time. However, because only one SQL statement is carried in each Q packet, the number of inserted records is 1.