Thread: SQLite
View Single Post
  #4  
Old 04-08-2009, 05:52 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Ok added SQLite support, when using the requestsql-commands then the default database is now a sqlite database

PHP Code:
requestsql("CREATE TABLE test (account varchar not null default '' primary key, age int not null default 1)"false);

requestsql("INSERT INTO test VALUES ('Stefan', 33)"false);
requestsql("INSERT INTO test VALUES ('Graal', 11)"false);
requestsql("INSERT INTO test VALUES ('Unixmad', 42)"false);

temp.req requestsql("SELECT * FROM test"true);
if (!
temp.req.completed)
  
waitfor(temp.req,"onReceiveData",60);
  
echo(
"Accounts in database: " temp.req.rows.size());
for (
temp.rowtemp.req.rows)
  echo(
"  Account: " temp.row.account ", age: " temp.row.age); 
Right now it's experimental (not checking for flooding etc.) so I can enable it on request.
To build the query string use string.escape() to avoid SQL injection.
The full list of supported SQL statements is available at http://www.sqlite.org/lang.html
Reply With Quote