C_CustomTable_DataMapper_Driver

Class C_CustomTable_DataMapper_Driver.

Defined (1)

The class is defined in the following location(s).

/products/photocrati_nextgen/modules/datamapper/package.module.datamapper.php  
  1. class C_CustomTable_DataMapper_Driver extends C_DataMapper_Driver_Base 
  2. /** 
  3. * The WordPress Database Connection 
  4. * @var wpdb 
  5. */ 
  6. var $_where_clauses = array(); 
  7. var $_order_clauses = array(); 
  8. var $_group_by_columns = array(); 
  9. var $_limit_clause = ''; 
  10. var $_select_clause = ''; 
  11. var $_delete_clause = ''; 
  12. public $_use_cache = TRUE; 
  13. function define($object_name = FALSE, $context = FALSE) 
  14. parent::define($object_name, $context); 
  15. $this->add_mixin('C_CustomTable_DataMapper_Driver_Mixin'); 
  16. $this->implement('I_CustomTable_DataMapper'); 
  17. function initialize($object_name = FALSE) 
  18. parent::initialize($object_name); 
  19. if (!isset($this->_primary_key_column)) { 
  20. $this->_primary_key_column = $this->_lookup_primary_key_column(); 
  21. $this->migrate(FALSE); 
  22. /** 
  23. * Returns the database connection object for WordPress 
  24. * @global wpdb $wpdb 
  25. * @return wpdb 
  26. */ 
  27. function _wpdb() 
  28. global $wpdb; 
  29. return $wpdb; 
  30. /** 
  31. * Looks up the primary key column for this table 
  32. */ 
  33. function _lookup_primary_key_column() 
  34. $key = $this->_wpdb()->get_row("SHOW INDEX FROM {$this->get_table_name()} WHERE Key_name='PRIMARY'", ARRAY_A); 
  35. if (!$key) { 
  36. throw new Exception("Please specify the primary key for {$this->get_table_name()}"); 
  37. return $key['Column_name'];