public function __construct($type = null, $start = null, $offset = false, $where = 1) { self::$db = CoreDB::init(); if (is_null($type)) { throw new CESyntaxError('Select type of aggregate.'); } if (!class_exists($type)) { throw new CETypeError('Cannot find specified type of aggregate.'); } $this->type = $type; $this->load($start, $offset, $where); }
/** * Constructor * * Creates prepared statements with acquire bindings. * * @access private */ private function __construct() { $this->_db = CoreDB::init(); $this->_stmt[self::ST_SEL] = $this->_db->prepare(sprintf("\n SELECT\n `value`\n FROM\n %s\n WHERE\n `key` = :key", TBL_CONFIG)); $this->_stmt[self::ST_DB] = $this->_db->prepare(sprintf("\n REPLACE\n %s\n SET\n `key` = :key,\n `value` = :value", TBL_CONFIG)); $this->_stmt[self::ST_DEL] = $this->_db->prepare(sprintf("\n DELETE FROM\n %s\n WHERE\n `key` = :key", TBL_CONFIG)); }
/** * Constructor * * Initialize database connection. */ public function __construct() { self::$db = CoreDB::init(); }