Hi, ALL,
I need to make a loop and in the loop I need to do following:
void CDb::Bar()
{
int result;
if( ( result = sqlite3_prepare_v2( m_handle, query1, -1, &stmt, 0 ) ==
SQLITE_OK )
sqlite3_step( stmt );
else
{
// error message
sqlite3_exec( m_handle, "ROLLBACK"... );
return;
}
if( result == SQLITE_OK )
{
if( ( result = sqlite3_prepare_v2( m_handle, query2, -1, &stmt, 0
) == SQLITE_OK )
sqlite3_step( stmt );
else
{
// error message
sqlite3_exec( m_handle, "ROLLBACK",.... );
return;
}
}
}
Problem is sqlite3_prepare_v2() wastes time by compiling SQL statements and
I'd like to avoid it by making this call only once and just
bind the appropriate parameters on each loop iteration.
Would it be possible if I make local function variable "static sqlite3_stmt
*stmt;" instead of class member variable?
Problem is in this case I will need 2 of them for each query, right?
Or is there a better way to improve this code?
Thank you.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users