Yes. At times I get so wound up in the details of various parts of the code that I miss the obvious of setting the stmt pointer to null before using it. Thank you to Jay for reminding me of this.
Your collective replies, answers and advice are very much appreciated, however the "how stupid are you" attitude of some of the posts are really quite ridiculous. Splitting hairs about my phrasing lacking the specifics of the levels of indirection to the statement doesn't change the fundamentals of the question, which was basically "how do I know if the stmt is initalized". Again thank you Jay for getting me out of the details so that the obvious became clear again. I'll try to be more clear in future questions. > From: paiva...@gmail.com > Date: Tue, 9 Mar 2010 13:21:18 -0500 > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] How can I query a sqlite3_stmt to find outif ithas been > run through the sqlite3_prepare_v2 function? > > > int sqlite3_prepare(sqlite3 *db, const char *zSql, int nByte, sqlite3_stmt > > **ppStmt, const char **pzTail); > > > > Please tell me what the 4th parameter is then if it not a statement so that > > I may ask you in the words you are looking for. > > It's not a statement. Speaking in Igor's words it's a _pointer_ to > statement. Speaking in Jay's words it's a _pointer_ to _pointer_ to > statement structure. > Usually when people say they have "function that is being passed an > sqlite3_stmt object" they mean this prototype: > > void f(sqlite3_stmt* stmt); > > If you will check for NULL inside this function (as Jay suggested) and > prepare statement if it's NULL then you will never have a non-NULL > value there and memory will leak from you significantly. > > > Pavel > > On Tue, Mar 9, 2010 at 1:07 PM, Ed Curren <ecur...@hotmail.com> wrote: > > > > According to the documentation the function prototype for > > sqlite3_prepare_v2 is the following: > > > > > > > > int sqlite3_prepare(sqlite3 *db, const char *zSql, int nByte, sqlite3_stmt > > **ppStmt, const char **pzTail); > > > > > > > > Please tell me what the 4th parameter is then if it not a statement so that > > I may ask you in the words you are looking for. > > > >> To: sqlite-users@sqlite.org > >> From: itandet...@mvps.org > >> Date: Tue, 9 Mar 2010 13:03:00 -0500 > >> Subject: Re: [sqlite] How can I query a sqlite3_stmt to find outif ithas > >> been run through the sqlite3_prepare_v2 function? > >> > >> Ed Curren <ecur...@hotmail.com> wrote: > >> > Okay, let's try asking the question this way then. How do I know if > >> > I need to call prepare based on the condition or value or whatever of > >> > a statement that may or may not have already been passed to perpare > >> > as a parameter? > >> > >> You _cannot_ pass a statement to prepare as a parameter. > >> > >> Igor Tandetnik > >> > >> _______________________________________________ > >> sqlite-users mailing list > >> sqlite-users@sqlite.org > >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > > _______________________________________________ > > sqlite-users mailing list > > sqlite-users@sqlite.org > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users