On Tue, Nov 12, 2013 at 10:43 AM, Clemens Ladisch <clem...@ladisch.de>wrote:

> Igor Korot wrote:
> > if( ( result = sqlite3_prepare_v2( handle, query, -1 &stmt, 0 ) ) !=
> SQLITE_OK )
> > // Should there be call to sqlite3_finalize. I.e. can I safely assume
> that since it failed all memory is not being allocated
>
> <http://www.sqlite.org/c3ref/prepare.html> says:
> | *ppStmt is left pointing to a compiled prepared statement that can be
> | executed using sqlite3_step(). If there is an error, *ppStmt is set to
> | NULL.
>

A related point which bit me once: if the input SQL is empty, the statement
will be NULL as well but 0 will be returned. So if the program is taking
arbitrary input from users, it may need to watch out for that case (and
simply do nothing).

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"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@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to