SQLite Forum

cannot start a transaction within a transaction using sqlite shell
> This ENTIRE bufferload consisting of THREE STATEMENTS is sent to the CLI for execution. However, the execution had an ABORT at the second statement in the batch; thus, aborting the batch. The COMMIT; statement was never executed.

I confirm this is how the shell handles "grouped" SQL statements.<sup><b>a</b></sup> By "grouped", I mean when each SQL input line either contains one or more semicolon-separated statements terminated by a semicolon, or ends with an open construct, such as a quoted string or identifier or a block comment which does not have its terminating token such that one or more additional lines are collected into the "group" before it is submitted to the library for execution (prepare(), step(), etc.) For example, this would be a group:<code>
  INSERT INTO Fiddle VALUES (1) /* and more!
  */ ,(2) ('and
  more'); SELECT * FROM Fiddle;

The bottom line is just as Keith says: Failure on one statement within the group precludes execution of latter statements within the group.


a. I confirm that general sense of the processing. But I would not say anything "is sent to the CLI for execution" except in the sense that the CLI accepts whole lines at a time. Whether or not lines are given over to the SQLite library for execution is determined by the CLI's own logic.