value.c_str() changing? Try binding with SQLITE_TRANSIENT to ensure SQLite takes a copy of the string when it is bound.