public function testAffectedRowsError() { $this->connection->getDriver()->setError('affected-rows'); $stmt = Statement::createDelete($this->connection, 'table'); $stmt->run(); $r = new ReflectionProperty($stmt, 'affectedRows'); $r->setAccessible(true); $this->assertFalse($r->getValue($stmt)); $this->setExpectedException('Neevo\\DriverException', 'Affected rows are not supported by this driver.'); $stmt->affectedRows(); }
public function testCloseConnection() { $this->instance->attachObserver($o = new DummyObserver(), DummyObserver::DISCONNECT); $this->instance->__destruct(); $this->assertTrue($this->instance->getDriver()->isClosed()); $this->assertTrue($o->isNotified()); }
/** * Returns the name of the PRIMARY KEY column. * @return string|null */ public function getPrimaryKey() { $table = $this->getTable(); if (!$table) { return null; } $key = null; $cached = $this->connection->getCache()->fetch($table . '_primaryKey'); if ($cached === null) { try { $key = $this->connection->getDriver()->getPrimaryKey($table, isset($this->resultSet) ? $this->resultSet : null); } catch (NeevoException $e) { return null; } $this->connection->getCache()->store($table . '_primaryKey', $key); return $key === '' ? null : $key; } return $cached === '' ? null : $cached; }
/** * Rollbacks changes in a transaction. * @param string $savepoint * @return Manager fluent interface */ public function rollback($savepoint = null) { $this->connection->getDriver()->rollback($savepoint); $this->notifyObservers(ObserverInterface::ROLLBACK); return $this; }