Sql: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
(→‎Description: Adding more detail to sqlList)
Line 3: Line 3:
== Description ==
== 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|SQLOpenDataBase]] function. ''sqlList'' is a SQLite command or an array of SQLite commands.
The Sql statement is used to send a transaction (a list of SQL commands) to SQLite. ''Db'' is the reference returned by an [[sqlopendatabase|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:
 
<pre>
[sqlStatement, successCallback, errorCallback]
</pre>
 
''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]].
For more information, see [[Using SQLite]].

Revision as of 18:36, 3 July 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

Output

(a table is dropped and added)