1.Dd December 19, 2018 2.Dt SQLITE3_COMPLETE 3 3.Os 4.Sh NAME 5.Nm sqlite3_complete , 6.Nm sqlite3_complete16 7.Nd Determine If An SQL Statement Is Complete 8.Sh SYNOPSIS 9.Ft int 10.Fo sqlite3_complete 11.Fa "const char *sql" 12.Fc 13.Ft int 14.Fo sqlite3_complete16 15.Fa "const void *sql" 16.Fc 17.Sh DESCRIPTION 18These routines are useful during command-line input to determine if 19the currently entered text seems to form a complete SQL statement or 20if additional input is needed before sending the text into SQLite for 21parsing. 22These routines return 1 if the input string appears to be a complete 23SQL statement. 24A statement is judged to be complete if it ends with a semicolon token 25and is not a prefix of a well-formed CREATE TRIGGER statement. 26Semicolons that are embedded within string literals or quoted identifier 27names or comments are not independent tokens (they are part of the 28token in which they are embedded) and thus do not count as a statement 29terminator. 30Whitespace and comments that follow the final semicolon are ignored. 31.Pp 32These routines return 0 if the statement is incomplete. 33If a memory allocation fails, then SQLITE_NOMEM is returned. 34.Pp 35These routines do not parse the SQL statements thus will not detect 36syntactically incorrect SQL. 37.Pp 38If SQLite has not been initialized using sqlite3_initialize() 39prior to invoking sqlite3_complete16() then sqlite3_initialize() is 40invoked automatically by sqlite3_complete16(). 41If that initialization fails, then the return value from sqlite3_complete16() 42will be non-zero regardless of whether or not the input SQL is complete. 43.Pp 44The input to sqlite3_complete() must be a zero-terminated 45UTF-8 string. 46.Pp 47The input to sqlite3_complete16() must be a zero-terminated 48UTF-16 string in native byte order. 49.Sh SEE ALSO 50.Xr sqlite3_complete 3 , 51.Xr sqlite3_initialize 3 52