complete



Determines if the specifie text seems to form a complete SQL statement.

Arguments: The arguments are:
text [required] The text to check.
Return value: Reurns 0 if the text is incomplete and 1 if the text seems complete. Note that the database engine allocates some memory when this method is executed. If memory allocation fails, the database engine will return the NOMEM constant. This is very unlikely to happen.
Remarks: This method is useful during command-line input to determine if the currently entered text seems to form a complete SQL statement or if additional input is needed before sending the text into ooSQLite for parsing. A statement is judged to be complete if it ends with a semicolon token and is not a prefix of a well-formed 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. Whitespace and comments that follow the final semicolon are ignored.
Details The functionality of thecompletemethod is similar to that of the SQLite sqlite3_complete API.
Example: This example show some possible output of using this method:
text = 'SELECT * from foods'
say 'Is "'text'" a complete SQL statement?' .ooSQLite~complete(text)
text = 'SELECT * from foods;'
say 'Is "'text'" a complete SQL statement?' .ooSQLite~complete(text)
say 'Value of NOMEM constant:' .ooSQLite~NOMEM
/* Output:
Is "SELECT * from foods" a complete SQL statement? 0
Is "SELECT * from foods;" a complete SQL statement? 1
Value of NOMEM constant: 7
*/