Frank Fiedler <[EMAIL PROTECTED]> wrote:
>    assert(sqlite3_step(drop_table_stmt) == SQLITE_DONE);

I don't know what is wrong with your program, but I
do see that you are misusing assert() - misusing it
rather badly.

An assert() statement is intended to express an
invariant.  It is intended to express a fact that
is always true about your code.  If you compile with
-DNDEBUG=1 then assert() becomes a no-op.  You should
think of an assert() as an executable comment - a 
comment about your code that is verified to be correct
at runtime.  Your program should always operate 
identically if all the assert() statements are
removed.

There are two problems with your use of assert().
This first is that you are calling sqlite3_step()
from within assert().  I don't think you want your 
sqlite3_step() calls to become no-ops, do you?  
The second error is that asserts are intended to 
detect internal inconsistencies within your own 
code - not external error conditions.  So you 
should never assert() that the return value from
sqlite3_step() is going to be SQLITE_DONE unless
SQLite promises that it will always return that value.
And it makes no such promise.  You might also get
SQLITE_ERROR, or SQLITE_BUSY.

--
D. Richard Hipp <[EMAIL PROTECTED]>


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to