Up |
_sqliteExec
Execute any sql instruction. This instruction can content several requests.
If the result gets any datas, the reflex _sqliteCallbackExec is called (if it is defined, of course)
Prototype :
fun [ObjSqlite S I] I
- ObjSqlite : a sqlite3 object.
- S : a valid sqlite request
- I : should be nil
Return : I if success or the error code (in this case, see http://www.sqlite.org/c3ref/c_abort.html).
See also :
Example :
fun mycallback (db, user_parameter, column, value)=
_fooS strcat "user parameter : " user_parameter;
_fooS strcat "column : " column;
_fooS strcat "value : " value;
0;;
fun main ()=
_showconsole;
let _sqliteOpenFile _channel _checkpack "tests/db/sqlite3/test_1.sqlite3" -> mydb in
if mydb == nil then
// do something
else
(
...
_sqliteCallbackExec mydb @mycallback "this is my callback";
// the reflex will not be called
_sqliteExec mydb "CREATE TABLE mytable (name char(50), surname char(50));
INSERT INTO mytable (name, surname) VALUES ('Thurman', 'Uma');
INSERT INTO mytable (name, surname) VALUES ('Wallace', 'Mia');
INSERT INTO mytable (name, surname) VALUES ('Cassini', 'Irene')"
nil;
// the reflex will be called
_sqliteExec mydb "SELECT surname FROM mytable" nil;
...
);
0;;