Package: Db
Database manager object for Omeka
While mostly a wrapper for a Zend_Db_Adapter instance, this also providesshortcuts for retrieving table objects and table names for use in SQL.
The prefix that every table in the omeka database will use.
The database adapter.
All the tables that are currently managed by this database object.
The logger to use for logging SQL queries. If not set, no logging will be done.
Parameters: |
|
---|
Delegate to the database adapter.
Parameters: |
|
---|---|
Returns: | mixed |
Magic getter is a synonym for Omeka_Db::getTableName().
Example: $db->Item is equivalent to $db->getTableName(‘Item’).
Parameters: |
|
---|---|
Returns: | string|null |
Set logger for SQL queries.
Parameters: |
|
---|
Retrieve the database adapter.
Returns: | Zend_Db_Adapter_Abstract |
---|
Retrieve the name of the table (including the prefix).
Parameters: |
|
---|---|
Returns: | string |
Check whether the database tables have a prefix.
Returns: | boolean |
---|
Retrieve a table object corresponding to the model class.
Table classes can be extended by inheriting off of Omeka_Db_Table andthen calling your table Table_ModelName, e.g. Table_Item orTable_Collection. For backwards compatibility you may call your tableModelNameTable, i.e. ItemTable or CollectionTable. The latter namingpattern is deprecated.
This will cache every table object so that tables are not instantiatedmultiple times for complicated web requests.
Parameters: |
|
---|---|
Returns: | Omeka_Db_Table |
Cache a table object.
Prevents the creation of unnecessary instances.
Parameters: |
|
---|
Every query ends up looking like: INSERT INTO table (field, field2, field3, ...) VALUES (?, ?, ?, ...) ON DUPLICATE KEY UPDATE field = ?, field2 = ?, ...
Note on portability: ON DUPLICATE KEY UPDATE is a MySQL extension.The advantage to using this is that it doesn’t care whether a row exists already.Basically it combines what would be insert() and update() methods in otherORMs into a single method
Parameters: |
|
---|---|
Returns: | integer The ID for the row that got inserted (or updated). |
Log SQL query if logging is configured.
This logs the query before variable substitution from bind params.
Parameters: |
|
---|
Execute more than one SQL query at once.
Parameters: |
|
---|
Read the contents of an SQL file and execute all the queries therein.
In addition to reading the file, this will make substitutions based onspecific naming conventions. Currently makes the following substitutions:%PREFIX% will be replaced by the table prefix.
Parameters: |
|
---|