[sqlite] sqlite_column_blob & invalid index
Ok, Thanks. On Sun, Apr 12, 2015 at 2:08 PM, Stephan Beal wrote: > On Sun, Apr 12, 2015 at 2:04 PM, gwenn wrote: > >> Thanks for reply. >> Could you please elaborate ? >> For me, there is no way to know if the specified column index is >> invalid by using the column value returned by >> sqlite3_column_blob/text/int . >> > > i was mistaken: the docs say: > > > "If the SQL statement does not currently point to a valid row, or if the > column index is out of range, the result is undefined. " > > But you can figure out the count: > > http://sqlite.org/c3ref/column_count.html > > > -- > - stephan beal > http://wanderinghorse.net/home/stephan/ > http://gplus.to/sgbeal > "Freedom is sloppy. But since tyranny's the only guaranteed byproduct of > those who insist on a perfect world, freedom will have to do." -- Bigby Wolf > ___ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] sqlite_column_blob & invalid index
On Sun, Apr 12, 2015 at 2:04 PM, gwenn wrote: > Thanks for reply. > Could you please elaborate ? > For me, there is no way to know if the specified column index is > invalid by using the column value returned by > sqlite3_column_blob/text/int . > i was mistaken: the docs say: "If the SQL statement does not currently point to a valid row, or if the column index is out of range, the result is undefined. " But you can figure out the count: http://sqlite.org/c3ref/column_count.html -- - stephan beal http://wanderinghorse.net/home/stephan/ http://gplus.to/sgbeal "Freedom is sloppy. But since tyranny's the only guaranteed byproduct of those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
[sqlite] sqlite_column_blob & invalid index
Thanks for reply. Could you please elaborate ? For me, there is no way to know if the specified column index is invalid by using the column value returned by sqlite3_column_blob/text/int . Regards. On Sun, Apr 12, 2015 at 11:50 AM, Stephan Beal wrote: > On Sun, Apr 12, 2015 at 11:48 AM, gwenn wrote: > >> Hello, >> Could you please tell me if sqlite3_errcode/sqlite3_errmsg should be >> called after each call to sqlite3_column_blob/text/int/... to check >> that the column index is valid ? >> > > Not needed - simply check the result code of your call to > sqlite3_column_xxx(). (Users should always check the result codes of their > sqlite3 API calls.) > > -- > - stephan beal > http://wanderinghorse.net/home/stephan/ > http://gplus.to/sgbeal > "Freedom is sloppy. But since tyranny's the only guaranteed byproduct of > those who insist on a perfect world, freedom will have to do." -- Bigby Wolf > ___ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] sqlite_column_blob & invalid index
On Sun, Apr 12, 2015 at 11:48 AM, gwenn wrote: > Hello, > Could you please tell me if sqlite3_errcode/sqlite3_errmsg should be > called after each call to sqlite3_column_blob/text/int/... to check > that the column index is valid ? > Not needed - simply check the result code of your call to sqlite3_column_xxx(). (Users should always check the result codes of their sqlite3 API calls.) -- - stephan beal http://wanderinghorse.net/home/stephan/ http://gplus.to/sgbeal "Freedom is sloppy. But since tyranny's the only guaranteed byproduct of those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
[sqlite] sqlite_column_blob & invalid index
Hello, Could you please tell me if sqlite3_errcode/sqlite3_errmsg should be called after each call to sqlite3_column_blob/text/int/... to check that the column index is valid ? I am confused by: > http://sqlite.org/rescode.html#range > The SQLITE_RANGE error indices that the parameter number argument to one of > the sqlite3_bind routines is out of range. Here , there is no mention to sqlite3_column_blob. > http://sqlite.org/c3ref/column_blob.html > if the column index is out of range, the result is undefined. Here, there is no mention to SQLITE_RANGE. > http://www.sqlite.org/cgi/src/artifact/583d56b129dd27f1 > static Mem *columnMem(sqlite3_stmt *pStmt, int i){ > ... > sqlite3Error(pVm->db, SQLITE_RANGE); > ... > } > http://www.sqlite.org/cgi/src/artifact/40e333960d53f7d5 > const char *sqlite3ErrStr(int rc){ > ... >/* SQLITE_RANGE */ "bind or column index out of range", > ... > } Here, there is a mention to "column index out of range" Regards.