|
|
Line 12: |
Line 12: |
|
| |
|
| For more information, see [[Using SQLite]]. | | For more information, see [[Using SQLite]]. |
|
| |
| == SQLite Error Codes ==
| |
| These codes are returned in err.code in the errCallBack function.
| |
| <pre>
| |
| OK 0 Successful result
| |
| ERROR 1 SQL error or missing database
| |
| INTERNAL 2 Internal logic error in SQLite
| |
| PERM 3 Access permission denied
| |
| ABORT 4 Callback routine requested an abort
| |
| BUSY 5 The database file is locked
| |
| LOCKED 6 A table in the database is locked
| |
| NOMEM 7 A malloc() failed
| |
| READONLY 8 Attempt to write a readonly database
| |
| INTERRUPT 9 Operation terminated by sqlite3_interrupt()*/
| |
| IOERR 10 Some kind of disk I/O error occurred
| |
| CORRUPT 11 The database disk image is malformed
| |
| NOTFOUND 12 Unknown opcode in sqlite3_file_control()
| |
| FULL 13 Insertion failed because database is full
| |
| CANTOPEN 14 Unable to open the database file
| |
| PROTOCOL 15 Database lock protocol error
| |
| EMPTY 16 Database is empty
| |
| SCHEMA 17 The database schema changed
| |
| TOOBIG 18 String or BLOB exceeds size limit
| |
| CONSTRAINT 19 Abort due to constraint violation
| |
| MISMATCH 20 Data type mismatch
| |
| MISUSE 21 Library used incorrectly
| |
| NOLFS 22 Uses OS features not supported on host
| |
| AUTH 23 Authorization denied
| |
| FORMAT 24 Auxiliary database format error
| |
| RANGE 25 2nd parameter to sqlite3_bind out of range
| |
| NOTADB 26 File opened that is not a database file
| |
| NOTICE 27 Notifications from sqlite3_log()
| |
| WARNING 28 Warnings from sqlite3_log()
| |
| ROW 100 sqlite3_step() has another row ready
| |
| DONE 101 sqlite3_step() has finished executing
| |
| </pre>
| |
|
| |
|
| == Example == | | == Example == |
Revision as of 22:13, 11 November 2013
Sql(db, sqlList)
Description
The Sql statement is used to send a transaction (a list of SQL commands) to SQLite. Db is the reference returned by an SQLOpenDataBase function. sqlList is an array of strings containing SQL statements to execute, or an array of arrays. In the case of an array of arrays, each entry should be of the following form:
[sqlStatement, successCallback, errorCallback]
sqlStatement is a string containing the SQL statement to execute. successCallback is a function which is called after the statement has finished executing. errorCallback is a function which is called if an error occurred while executing the statement.
For more information, see Using SQLite.
Example
Rem Sql statement sample
sqlList=[]
sqlList[0]=["Drop Table customerData;",,skipError]
sqlList[1]=["Create Table customerData('name', 'age', 'sales', PRIMARY KEY('name') );"]
Sql(DB, sqlList)
Function skipError(tx, err)
Print "Error: " & err.errcode
End Function
Output
(a table is dropped and added)
Related Items
SqlOpenDatabase
SQLite Reference
Using SQLite