|
int sqlite3_complete(const char *sql); int sqlite3_complete16(const void *sql);
These functions return true if the given input string comprises one or more complete SQL statements. For the sqlite3_complete() call, the parameter must be a nul-terminated UTF-8 string. For sqlite3_complete16(), a nul-terminated machine byte order UTF-16 string is required.
These routines are useful for command-line input to determine if the currently entered text forms one or more complete SQL statements or if additional input is needed before sending the statements into SQLite for parsing. The algorithm is simple. If the last token other than spaces and comments is a semicolon, then return true. Actually, the algorithm is a little more complicated than that in order to deal with triggers, but the basic idea is the same: the statement is not complete unless it ends in a semicolon.
See also lists of Objects, Constants, and Functions.