OK Thanks for your reply. Yeah, I know that sqlite3_get_table() allocates the memory for me, but thanks for the heads up any way!
I think the possibility of checking the number of rows will be sufficient for my purposes... If I don't check is there not a possibility of there not being enough memory to fit the returned data? I guess Sqlite checks for this when doing the malloc? Is there a specific error returned when this is the case (i.e. it runs out of memory)? It's hardly likely to happen but I need to handle the case none the less... Thanks again, Richard. > I was wondering if there was a way to find the size of data that will be > returned before actually making the call to sqlite3_get_table which will > return a pointer to a malloc'd memory location. My question is really: can I > find the required memory size before the call? The short answer is no, not without executing a "SELECT count() ..." statement to figure out how many rows will be returned by your statement. Sanity check: You know that sqlite3_get_table() allocates the memory for you, right (which you then free later using sqlite3_free_table())? You don't have to supply your own malloc'd blob.