> but only after at least one sqlite3_step() occurred. It will work before any step, but indeed the statement needs to be prepared. I need to know before stepping, but it can do that.
RBS On Sat, Jan 9, 2016 at 12:57 PM, R Smith <rsmith at rsweb.co.za> wrote: > > > On 2016/01/09 1:30 PM, Clemens Ladisch wrote: > >> Bart Smissaert wrote: >> >>> I am interested to know from the statement string if the statement is >>> invalid, row producing (could produce rows) or non row producing. >>> >> <http://www.sqlite.org/c3ref/column_count.html> says about >> sqlite3_column_count(): >> | Return the number of columns in the result set returned by the >> | prepared statement. This routine returns 0 if pStmt is an SQL >> | statement that does not return data (for example an UPDATE). >> > > Indeed, but unless I am mistaken, that value is not available (in a > meaningful sense anyway) upon compilation of the SQL statement, aka > sqlite3_prepare(), but only after at least one sqlite3_step() occurred. > > It seems to me the OP needs to know whether output rows will happen BEFORE > stepping. (I don't see a reason why or argue for it, just relaying what I > think the OP intended with the question). > > It might be useful, some Pragmas (for instance) return values, some don't, > and this may change in future, etc. For myself though, knowing whether > output is produced or not is perfectly fine after stepping - and for that > simply checking the return values from the sqlite functions is enough. See: > https://www.sqlite.org/c3ref/step.html > > > Cheers, > Ryan > > > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >