Vladimir, Thank you for your responses. One short followup:
This would suggest that the whole string is parsed even if it contains more than one statement.A. what happens to the zSql? Is it copied or it is assumed that this is a static text? Suppose I call sqlite3_prepare in one place and immediately release dynamically allocated text. sqlite3_prepare parses only the first statement. Then I call sqlite3_step as many times as needed. Will it crash when trying to parse next statements in next steps?zSql is parsed and turned into an internal VM bytecode for later execution; you're under no obligation to keep zSql around after prepare returns.
According to documentation on sqlite3_prepare():
"This routine only compiles the first statement in zSql, so *pzTail is left pointing to what remains uncompiled."
I don't understand something. Suppose you have 2 statements in the SQL string. Do you have to call sqlite3_prepare() 2 times? I was under impression that sqlite3_step() will do it for me if I call it multiple times. I tried to find some sample code via google and I did not see a single example of calling sqlite3_prepare() multiple times for one SQL string.B. Is pzTail of any use? I can see that inside the library code it is checked against NULL before assigning the output text pointer but the documentation does not state explicitly that this parameter is optional. I don't want to rely on internal implementation (which may change in future release) when the docs don't say it is optional. It would be nice to clarify this.
It's useful if you're reading SQL from the user, and you get, say, two INSERT commands in one string. pzTail will let you call prepare/step/etc. multiple times to evaluate all the sql. It would be good to explicitly state that it may be NULL.
Thanks in advance, Tom Abracode http://www.abracode.com