Project

General

Profile

Up

_sqliteExecResult

Run a sqlite request and return the result without callback.

Prototype :

fun [ObjSqlite S I] [[[S S] r1] r1]

  • ObjSqlite : a sqlite3 object.
  • S : a valid sqlite request (or several requests in the same string).
  • I : should be nil.

Return : [[[S S] r1] r1] the result : a list of tuples 'column', 'value' or nil if error (internal, bad request, ...).

See also :

_sqliteExecResult

Example :

typeof db = ObjSqlite;;

fun main ()=
	_showconsole;

	set db = _sqliteOpenFile _channel _checkpack "tests/db/sqlite3/test_1.sqlite3";
	if db == nil then
		_fooS "ERROR DB"
	else
		nil;

	let "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;" -> sql in
	let _sqliteExecResult db sql nil -> result in
	let _fooS "--> BEGIN" -> _ in
	while result != nil do
		let hd hd result -> [a v] in
		(
		_fooS strcat "Attr = " a;
		_fooS strcat "Val = " v;
		_fooS "";
		set result = tl result;
		);
	_fooS "--> END";
	0;;