Does a pointer need to be removed from the sqlite3_column_blob () method?

Similar to this: const void * test = sqlite3_column_blob (stat, 1); Is it possible to delete or delete the [] test?

+3
source share
2 answers

From sqllite documentation :

The returned pointers are valid until type conversion occurs or sqlite3_step () or sqlite3_reset () or sqlite3_finalize () is called. The amount of memory used to store strings and BLOBs is freed automatically. Do not pass the pointers returned by sqlite3_column_blob () to sqlite3_free ().

+7
source

Take a look at his API Guide. If it is a C API, you probably should free it. If it does not provide its own function, e.g. sqlite3_free (e.g. pcre), you should use this function.

What you cannot do is delete it using the C ++ delete operator, since you have a pointer to void. You cannot delete the void pointer, because the compiler must know about its type. (and void is an incomplete type, you also cannot remove incomplete types).

0
source

All Articles