sqlite3_prepare*() statement argument detailed

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

sqlite3_prepare*() statement argument detailed

E.D.
Hi.

The sqlite3 documentation specifies, that sqlite3_prepare*() compile "the first statement" from the sqlite3_stmt ** argument. This argument ought to be explained thoroughly.
What exactly can be put through this argument? Compound statements, transactions? What syntax?
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3_prepare*() statement argument detailed

Stephan Beal-3
On Mon, May 16, 2016 at 2:58 PM, E.D. <[hidden email]> wrote:

> Hi.
>
> The sqlite3 documentation specifies, that sqlite3_prepare*() compile "the
> first statement" from the sqlite3_stmt ** argument. This argument ought to
> be explained thoroughly.
> What exactly can be put through this argument? Compound statements,
> transactions? What syntax?
>

The first _SQL statement_ is processed. Anything after that is ignored. e.g.

select 1 from foo; -- first statement ends here
select 2 from foo; -- this is ignored.


--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3_prepare*() statement argument detailed

R.A. Nagy
In reply to this post by E.D.
SQL statements end with a ";"

That is what is meant by "statement."



On Mon, May 16, 2016 at 8:58 AM, E.D. <[hidden email]> wrote:

> Hi.
>
> The sqlite3 documentation specifies, that sqlite3_prepare*() compile "the
> first statement" from the sqlite3_stmt ** argument. This argument ought to
> be explained thoroughly.
> What exactly can be put through this argument? Compound statements,
> transactions? What syntax?
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3_prepare*() statement argument detailed

R Smith
In reply to this post by E.D.


On 2016/05/16 2:58 PM, E.D. wrote:
> Hi.
>
> The sqlite3 documentation specifies, that sqlite3_prepare*() compile "the first statement" from the sqlite3_stmt ** argument. This argument ought to be explained thoroughly.
> What exactly can be put through this argument? Compound statements, transactions? What syntax?

I don't think there is such a thing as a compound statement, it's just a
statement. A transaction is not a statement either. "BEGIN;" is a statement.

If I had to try my hand at a definition, I'd say a statement is any
single SQL Query that is in itself a complete instruction, starts with
an SQL keyword and optionally ends with a ";" (assuming you haven't
changed the statement termination character). MSSQL allows you terminate
with a <CRLF> and a "GO", etc.

What that piece of documentation simply means is that any statement
after the first will be ignored, so basically everything after the first
terminating ";", if any.

Further, any statement in SQLite that does not follow another statement
that started a transaction, is in itself implicitly a transaction.

To get multiple statements to be executed, you can try the
sqlite3_execute() method - it allows multiple statement lists (aka
scripts or "compound" statement s if you like) and transactions.


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3_prepare*() statement argument detailed

Clemens Ladisch
In reply to this post by E.D.
E.D. wrote:
> The sqlite3 documentation specifies, that sqlite3_prepare*() compile
> "the first statement" from the sqlite3_stmt ** argument. This argument
> ought to be explained thoroughly.

It is explained thoroughly on <http://www.sqlite.org/lang.html>.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users