If the first loop exits with res3 == SQLITE_DONE then !result will be true and 
the second loop should process exactly the same (assuming underlying data is 
unchanged). I can’t see why the code below wouldn’t work although I’m confused 
by the fact you say that sqlite3_step(stmt3)  returns SQLITE_DONE immediately 
after the sqlite3_reset(stmt3) but later say it’s returning 1 (SQLITE_ERROR).


int result = 0,  res3 = SQLITE_OK;
for( ; ; )
{
        res3 = sqlite3_step( stmt3 );
        if( res3 == SQLITE_ROW )
        {
                // initial processing
        }
        else if( res3 == SQLITE_DONE )
                break;
        else
        {
                // error handling
                result = 1;
        }
}
if( !result )
{
        res3 = sqlite3_reset( stmt3 );
        for( ; ; )
        {
                res3 = sqlite3_step( stmt3 );
                if( res3 == SQLITE_ROW )
                {
                       // actual processing
                }
                else if( res3 == SQLITE_DONE )
                       break;
                else
                {
                       // error handling
                }
        }
}

Not sure where this code belongs

if( res3 != SQLITE_DONE )
break;
}

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to