Class Omeka_Db

Description

Database manager object for Omeka While mostly a wrapper for a Zend_Db_Adapter instance, this also provides shortcuts for retrieving table objects and table names for use in SQL.

Database manager object for Omeka While mostly a wrapper for a Zend_Db_Adapter instance, this also provides shortcuts for retrieving table objects and table names for use in SQL.

  • author: CHNM
  • copyright: Center for History and New Media, 2007-2008
  • uses: Zend_Db_Adapter_Mysqli

Located in /application/libraries/Omeka/Db.php (line 20)


	
			
Variable Summary
 string $prefix
 mixed $_conn
 array $_tables
Method Summary
 void __construct (Zend_Db_Adapter $conn, [string $prefix = null])
 Zend_Db_Statement exec (string $sql, [array $params = array()])
 void execBlock ( $sql)
 void getAdapter ()
 void getConnection (string 0)
 Omeka_Db_Table getTable (string $class)
 string getTableName ( $class)
 bool hasPrefix ()
 int insert ( $table, [ $values = array()])
 void log ( $sql)
 mixed __call (string $m, array $a)
 string|null __get ( $name)
Variables
string $prefix = null (line 29)

The prefix that every table in the omeka database will use.

The prefix that every table in the omeka database will use. If null this is ignored

  • access: public
mixed $_conn (line 22)
  • access: protected
array $_tables = array() (line 36)

All the tables that are currently managed by this database object

All the tables that are currently managed by this database object

  • access: protected
Methods
Constructor __construct (line 43)
  • access: public
void __construct (Zend_Db_Adapter $conn, [string $prefix = null])
  • Zend_Db_Adapter $conn: A connection object courtesy of Zend Framework
  • string $prefix: The prefix for the database (if applicable)
exec (line 228)
  • deprecated: Since 4/30/08
  • access: public
Zend_Db_Statement exec (string $sql, [array $params = array()])
  • string $sql
  • array $params
execBlock (line 239)

Convenience function for when server setup disallows executing more than

Convenience function for when server setup disallows executing more than one SQL query at a time

  • access: public
void execBlock ( $sql)
  • $sql
getAdapter (line 90)
  • access: public
void getAdapter ()
getConnection (line 85)
  • deprecated:
  • access: public
void getConnection (string 0)
  • string 0
getTable (line 125)

Retrieve a table object corresponding to the model class.

Retrieve a table object corresponding to the model class. Table classes can be extended by inheriting off of Omeka_Db_Table and then calling your table ModelNameTable, i.e. ItemTable or CollectionTable, etc.

  • access: public
Omeka_Db_Table getTable (string $class)
  • string $class: Model class name
getTableName (line 100)

Retrieve the name of the table (including the prefix)

Retrieve the name of the table (including the prefix)

  • access: public
string getTableName ( $class)
  • $class
hasPrefix (line 109)

A shortcut for checking to see whether the database tables have a prefix

A shortcut for checking to see whether the database tables have a prefix

  • access: public
bool hasPrefix ()
insert (line 165)

Every query ends up looking like: INSERT INTO table (field, field2, field3, . ON DUPLICATE KEY UPDATE field = ?, field2 = ?, .

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 other ORMs into a single method

  • return: The ID for the row that got inserted (or updated)
  • access: public
int insert ( $table, [ $values = array()])
  • $table
  • array $values
log (line 215)
  • access: protected
void log ( $sql)
  • $sql
__call (line 61)

Delegate to the Zend_Db_Adapter instance.

Delegate to the Zend_Db_Adapter instance. Log queries if necessary

  • todo: Come up with a better solution for logging bad queries. Zend_Db_Profiler won't help with logging broken queries, so we need to keep this for the sake of logging those.
  • access: public
mixed __call (string $m, array $a)
  • string $m
  • array $a
__get (line 148)

Magic getter is a synonym for Omeka_Db::getTableName()

Magic getter is a synonym for Omeka_Db::getTableName()

  • access: public
string|null __get ( $name)
  • $name

Documentation generated on Thu, 15 Oct 2009 15:36:26 -0400 by phpDocumentor 1.4.2