On 11/2/2011 2:46 PM, John Markavitch wrote:
iRes = sqlite3_step(statement); if ((iRes == SQLITE_ROW) || (iRes == SQLITE_DONE)) { psItemPID = sqlite3_column_text (statement, 0); // column 0 item pid psLocation = sqlite3_column_text (statement, 7); // location - KYTR.mp3} /****** if I use sqlite3_finalize () here, All following sqlite3_prepare_v2 error */ /* If I do not use sqlite3_finalize () here, sqlite3_prepare_v2 does not error */ // iRes = sqlite3_finalize(statement);
psItemPID and psLocation pointers are only valid while the statement is a) active, and b) still positioned on the same row (by the way, you shouldn't be calling sqlite3_column_* after _step returns SQLITE_DONE - at that time, the statement is positioned past the last row). When you call sqlite3_finalize, the memory these pointers point to gets deallocated and they now point to random garbage. You then write that garbage into sCmd.
-- Igor Tandetnik _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

