This is a cleaned up version of the Database (MySQL at the moment) in use at Academic Superstore.
Most notably, all the "doSomething" functions are now "something" and all the backward compatibility cruft for A.S.'s legacy Persistent class have been removed.
This file is released under the FreeBSD license.
Located in /as_database/As_Database.class.php (line 15)
Class | Description |
---|---|
CoughAsDatabase | Cough DAL (Database Adapter Layer) for the "as_database" module. |
Whether or not we are currently in a transaction.
Whether or not to log backtraces when logging queries
Whether or not to log all queries (to variable)
Logged queries since logQueries was turned on
Commit a transaction.
Returns the error message from the last query run.
Returns the number of found rows from the last run query.
Make sure to put SQL_CALC_FOUND_ROWS immediately after the SELECT in order for this to work.
Like the query log, but it rolls up all duplicate queries into only one entry in the array. It adds a count value equal to the number of times the query was run, and the time value is equal to the total time of each query run.
Perform an INSERT.
This function is Persistent Compatible.
Like insertOrUpdate, except a WHERE clause is not required
Using this function will keep DUPLICATE KEY errors at bay for when you don't have access to the primary key. If you DO have access to the primary key, you can use insertOrUpdate and pass in the key values as the $where parameter.
result function
Execute a database query and retrieve the value of the first field in the result
Rollback a non-committed transaction.
Starts a transaction.
Example Usage:
$db->startTransaction(); try { $db->query($sql1); $db->query($sql2); $db->query($sql3); $db->commit(); } catch (Exception $e) { $db->rollback(); }
Documentation generated on Wed, 12 Nov 2008 21:56:09 -0600 by phpDocumentor 1.4.0