Back to Comparison to Sitellite CMS.
Elefant borrows its core database functions directly from Sitellite, but renames them from db_*()
to DB::*()
. It strays from Sitellite in providing a database connection manager that supports lazy-loading, master/slave awareness (reads are sent to master automatically), and uses a base Model
class for organizing application logic.
The functions from Sitellite that Elefant supports are:
DB::error()
- Return the last error messageDB::execute()
- Execute and return booleanDB::fetch()
- Fetch an array of objectsDB::last_id()
- Fetch the last inserted idDB::pairs()
- Fetch an associative array of two fieldsDB::shift()
- Fetch a single field from the first resultDB::shift_array()
- Fetch an array of a single fieldDB::single()
- Fetch a single objectThe PDO connections are stored in a static Database object and can be retrieved via DB::get_connection()
.
From here, the two diverge. Sitellite uses its collections with lots of introspection and layers, and Elefant opts for a very stripped down Model
class (see Database API and models).