Skip to content

Commit

Permalink
pythongh-95273: Improve sqlite3.complete_statement docs
Browse files Browse the repository at this point in the history
  • Loading branch information
erlend-aasland committed Aug 9, 2022
1 parent 70fc964 commit 2d3b7f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 39 deletions.
33 changes: 0 additions & 33 deletions Doc/includes/sqlite3/complete_statement.py

This file was deleted.

14 changes: 8 additions & 6 deletions Doc/library/sqlite3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,16 @@ Module functions

.. function:: complete_statement(statement)

Returns ``True`` if the string *statement* contains one or more complete SQL
statements terminated by semicolons. It does not verify that the SQL is
syntactically correct, only that there are no unclosed string literals and the
statement is terminated by a semicolon.
Return ``True`` if the string *statement* appears to contain one or more
complete SQL statements terminated by semicolons.
No syntactic verification or parsing of any kind is performed.

This can be used to build a shell for SQLite, as in the following example:
This function may be useful during command-line input
to determine if the entered text seems to form a complete SQL statement,
or if additional input is needed before :meth:`executing <Cursor.execute>`
the statement.

.. literalinclude:: ../includes/sqlite3/complete_statement.py
See :source:`Lib/sqlite3/__main__.py` for example use.

.. function:: enable_callback_tracebacks(flag, /)

Expand Down

0 comments on commit 2d3b7f1

Please sign in to comment.