The database object is a singleton. You can pull the instance as follows:
$db = db::init();
The first time this is called, a new database instance will be created. After that, the old object is simply returned. If you are in the littlefoot context, this is already likely accessible at
Run query, return SQL result, increment SQL counter
Run query and return first row returned as an array. Increment SQL counter.
Run query and return matrix array of the rows:
array( 0 => array(id => 1, col1 => 'valA', col2 => 'val1', ...), 1 => array(id => 2, col1 => 'valB', col2 => 'val2', ...) )
SQL commands are preg_match()'d out of $file and run in a loop with errors suppressed
$folder is the destination, $table will print only the table instead of the whole database
$string is usually user-supplied supplied data. Don't forget to sanatize input!
You can read more things about the db class in the PHP Doc
Now for the ORM