I started writing a tutorial for it, but never finished. It's a good starting point, though. You can find it
here.
Once you've gotten a basic understanding, I'm willing to answer any questions you have (and I'm sure others are too).
EDIT: Oh, I see what you mean.
PHP Code:
function onCreated() {
temp.request = requestsql("SELECT * FROM bank", true);
waitFor(request, "onReceiveData", 60);
for (temp.row : request.rows) {
echo(row.account @ ": " @ row.money);
}
}
You use the command
requestsql(str query, bool expectReturn). I find it useful to write your own wrapper function.
PHP Code:
function req(query, expect) {
temp.req = requestsql(query, expect);
if (expect) {
waitFor(req, "onReceiveData", 60);
}
if (req.error != null) {
echo("SQL Error: " @ req.error);
echo(" Query: " @ query);
}
return req;
}
Then you would use it like
PHP Code:
temp.query = req("SELECT * FROM bank", true);
for (temp.row : query.rows) {
echo(row.account @ ": " @ row.money);
}
Eventually you'll also want to be able to select a database, too... something like this:
PHP Code:
function req(db, query, expect) {
temp.req = requestsql2(db, query, expect);
if (expect) {
waitFor(req, "onReceiveData", 60);
}
if (req.error != null) {
echo("SQL Error (" @ db @ ": " @ req.error);
echo(" Query: " @ query);
}
return req;
}