sqlite3_get_table
is defined as below:
int sqlite3_get_table(
sqlite3 *db, /* An open database */
const char *zSql, /* SQL to be evaluated */
char ***pazResult, /* Results of the query */
int *pnRow, /* Number of result rows written here */
int *pnColumn, /* Number of result columns written here */
char **pzErrmsg /* Error msg written here */
);
As it said in the document, it can get a result table convenient and is implemented as a wrapper around sqlite3_exec().
But it is now not recommended:
This is a legacy interface that is preserved for backwards compatibility. Use of this interface is not recommended.
But if I use sqlite3_exec
, I need to write a extra callback function. It is more complex。
So my question is what the main problem of this interface is? Why it need to be deprecated?
For more information see http://www.sqlite.org/c3ref/free_table.html.
The problems with sqlite3_get_table
are that all values are converted to strings, and that memory must be allocated for all result records.
You are supposed to use the sqlite3_prepare_v2/sqlite3_step/sqlite3_column_xxx/sqlite3_finalize functions.
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