On Wed, Jul 10, 2013 at 12:37 AM, Igor Korot <ikoro...@gmail.com> wrote:
> Hi, ALL, > Consider following code: > > std::string query = "SELECT a FROM foo;"; > > sqlite3_prepare_v2( handle, query, -1, &stmt, 0 ); > sqlite3_step( stmt ); int id = sqlite_column_int( stmt, 0 ); > Right here the results are undefined. sqlite3_column_xxx() and friends are only legal to call if step() has succeeded, and you code skips over the error check, making any further analysis of errors essentially meaningless. > int code = sqlite3_column_int( stmt, 1 ); > > > Shouldn't the engine assert in this case? > The engine expects you to do the right thing with the result codes - they are there for a reason. Assertion is a last-ditch safety effort which is only enabled in debug builds. -- ----- stephan beal http://wanderinghorse.net/home/stephan/ http://gplus.to/sgbeal _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users