Hi, ALL, I am developing an application using C API of SQLite. During the program flow I need to insert a record in one of the tables inside transaction. Record inserts OK (no error message generated), but when I try to check using the SQLite console the record is not present. I let the transaction finish and check using the console program - record is still not present.
When I'm trying to look at the debugger I see the SQL statement that is executed. Trying to execute exactly the same statement using the console result in the record appearance. Here is the code: query = wxString::Format( "INSERT INTO playersdrafted VALUES( %d, %d, ( SELECT ownerid FROM owners WHERE ownername = \"%s\" AND id = %d ), %d, %d, \"%s\" );", player.GetPlayerId(), leagueId, const_cast<CPlayer &>( player ).GetOwner(), leagueId, player.GetAmountPaid(), player.GetDraftOrder(), const_cast<CPlayer &>( player ).GetDraftedPosition() ); if( ( result = sqlite3_prepare_v2( m_handle, query, -1, &stmt, 0 ) ) != SQLITE_OK ) wxMessageBox( wxString::Format( "Error updating players: %s", sqlite3_errmsg( m_handle ) ) ); else sqlite3_step( stmt ); sqlite3_finalize( stmt ); An inner query returns only one record. The resulting query is: "INSERT INTO playersdrafted VALUES( 125, 1, (SELECT ownerid FROM owners WHERE ownername = "Team 1" AND id = 1 ), 38, 1, "OF" );" If needed I can send the database off list to check, but hopefully it will not be needed. ;-) I guess I just need a pair of fresh eyes. Thank you. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users