purely unsolicited, non-SQL related words here (I don't want to classify them as 'advice') --
On Tue, Mar 9, 2010 at 12:33 PM, Ed Curren <ecur...@hotmail.com> wrote: > > 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. > > To the veterans on the list, it is very clear that no one had a "how stupid are you" attitude, although I can understand that those new to the list might feel that way. This is a new place. Welcome. One rule of SQL -- at least one person who replied to you is never wrong. I am not joking here. That one person is NEVER wrong. Even the creator of SQLite might be wrong, but at least one responder on this list is NEVER wrong. Even if a particular reply might seem brusque, in reality it is only a gentle, non-malicious attempt to veer the OP into the right direction. In all likelihood, in fact, from all evidence from the postings, all the folks responding are probably some of the nicest people we SQL-wise lesser mortals will have the privilege of learning from. Good luck in your SQL adventures... hopefully soon you will be helping others. > > 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 >> >> -- Puneet Kishor http://www.punkish.org Carbon Model http://carbonmodel.org Charter Member, Open Source Geospatial Foundation http://www.osgeo.org Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor Nelson Institute, UW-Madison http://www.nelson.wisc.edu ----------------------------------------------------------------------- Assertions are politics; backing up assertions with evidence is science ======================================================================= _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users