On Wed, Aug 01, 2012 at 08:49:19PM +1000, Yose Widjaja scratched on the wall: > Dear Friends, > > So SQLITE_STATIC is meant to be used for data that is static. However, > would it still be safe when it is used with data that expires after the > sqlite3_step() function? > > For example: > > string hello = "hello world"; > > sqlite3_bind(statement, 1, hello.c_str(), hello.size(), SQLITE_STATIC); > > sqlite3_step(statement); > > hello = "moo"; > > Would there be anything that can potentially go wrong? I mean, since > SQLITE_STATIC is meant to imply static stuff, would sqlite cache the value > in such a way that subsequence SELECT_ statements actually use this static > value that was passed in through the bind function?
It would be better to keep the value valid until _reset() or _finalize() is called, but, yes... this use of SQLITE_STATIC is acceptable (and somewhat common). -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users