* @link http://netmonsters.ru * @package Majestic * @subpackage db * @since 2011-11-10 */ /** * @property Mongo $connection */ class MongoDriver extends NoSqlDbDriver { public function find($data, $params = array(), $cache_key = null) { } public function insert($table, $bind, $on_duplicate = array()) { return parent::insert($table, $bind, $on_duplicate); } public function update($table, $bind, $where = '') { return parent::update($table, $bind, $where); } public function delete($table, $where = '') { return parent::delete($table, $where); } public function getInsertId($table = null, $key = null) { // TODO: Implement getInsertId() method. } public function isConnected() { if (!is_null($this->connection)) { return $this->connection->connected; } else { return false; } } public function disconnect() { if ($this->isConnected()) { $this->connection->close(); } $this->connection = null; } protected function connect() { if ($this->connection) { return; } $host = $this->config['hostname']; $port = isset($this->config['port']) ? ':' . (string) $this->config['port'] : ''; $this->config = array( 'username' => $this->config['username'], 'password' => $this->config['password'], 'db' => $this->config['database'] ); $this->connection = new Mongo('mongodb://' . $host . $port, $this->config); } }