Small. Fast. Reliable.
Choose any three.

About Sitemap Documentation Download License News Developers Support

## SQLite C Interface

## Determine If An SQL Statement Is Complete

>     int sqlite3_complete(const char *sql);
>     int sqlite3_complete16(const void *sql);

These routines are useful for command-line input to determine if the currently entered text seems to form complete a SQL statement or if additional input is needed before sending the text into SQLite for parsing. These routines return true if the input string appears to be a complete SQL statement. A statement is judged to be complete if it ends with a semicolon token and is not a fragment of a CREATE TRIGGER statement. Semicolons that are embedded within string literals or quoted identifier names or comments are not independent tokens (they are part of the token in which they are embedded) and thus do not count as a statement terminator.

These routines do not parse the SQL statements thus will not detect syntactically incorrect SQL.

### Invariants:

H10511 | A successful evaluation of sqlite3_complete() or sqlite3_complete16() functions shall return a numeric 1 if and only if the last non-whitespace token in their input is a semicolon that is not in between the BEGIN and END of a CREATE TRIGGER statement.
H10512 | If a memory allocation error occurs during an invocation of sqlite3_complete() or sqlite3_complete16() then the routine shall return SQLITE_NOMEM.

### Assumptions:

A10512 | The input to sqlite3_complete() must be a zero-terminated UTF-8 string.
A10513 | The input to sqlite3_complete16() must be a zero-terminated UTF-16 string in native byte order.

See also lists of Objects, Constants, and Functions.

This page last modified 2008/12/09 18:44:04 UTC