/** * Get Connection * * @param array $config * @return Varien_Db_Adapter_Mysqli */ public function getConnection($config) { $configArr = (array) $config; $configArr['profiler'] = !empty($configArr['profiler']) && $configArr['profiler'] !== 'false'; $configArr['pdoType'] = str_replace('pdo_', '', $configArr['type']); $conn = new Zend_Db_Adapter_Pdo_Mssql($configArr); if (!empty($configArr['initStatements']) && $conn) { $conn->query($configArr['initStatements']); } return $conn; }
public function testAdapterExceptionInvalidLoginCredentials() { $params = $this->_util->getParams(); $params['password'] = '******'; // invalid password try { $db = new Zend_Db_Adapter_Pdo_Mssql($params); $db->getConnection(); // force connection $this->fail('Expected to catch Zend_Db_Adapter_Exception'); } catch (Zend_Exception $e) { $this->assertType('Zend_Db_Adapter_Exception', $e, 'Expecting object of type Zend_Db_Adapter_Exception, got ' . get_class($e)); } }
protected function _dsn() { if (isset($this->_config['type'])) { $this->_config['pdoType'] = $this->_config['type']; } return parent::_dsn(); }
/** * Inserts a table row with specified data. * * @param mixed $table The table to insert data into. * @param array $bind Column-value pairs. * @return int The number of affected rows. */ public function insert($table = null, array $bind = null) { if (is_null($table) && is_null($bind)) { return new Harmoni_Db_Insert($this); } else { return parent::insert($table, $bind); } }