From 0bafdb6694b4461d285dadbfbdd116ddec975276 Mon Sep 17 00:00:00 2001 From: zYne Date: Wed, 10 Jan 2007 20:34:25 +0000 Subject: [PATCH] Minor fixes --- lib/Doctrine/Export.php | 2 +- lib/Doctrine/Export/Mysql.php | 10 +++++----- lib/Doctrine/Sequence/Sqlite.php | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/Doctrine/Export.php b/lib/Doctrine/Export.php index f7f42cf96..6562d9388 100644 --- a/lib/Doctrine/Export.php +++ b/lib/Doctrine/Export.php @@ -161,7 +161,7 @@ class Doctrine_Export extends Doctrine_Connection_Module * @param string $start start value of the sequence; default is 1 * @return void */ - public function createSequence($seqName, $seqcolName, $start = 1) + public function createSequence($seqName, $start = 1) { throw new Doctrine_Export_Exception('Create sequence not supported by this driver.'); } diff --git a/lib/Doctrine/Export/Mysql.php b/lib/Doctrine/Export/Mysql.php index 2a907954b..2a90893d1 100644 --- a/lib/Doctrine/Export/Mysql.php +++ b/lib/Doctrine/Export/Mysql.php @@ -320,13 +320,13 @@ class Doctrine_Export_Mysql extends Doctrine_Export * @param string $start start value of the sequence; default is 1 * @return boolean */ - public function createSequence($sequenceName, $seqcol_name, $start = 1) + public function createSequence($sequenceName, $seqcolName, $start = 1) { $query = 'CREATE TABLE ' . $sequenceName - . ' (' . $seqcol_name . ' INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (' + . ' (' . $seqcolName . ' INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (' . $seqcol_name . '))' - . strlen($this->dbh->options['default_table_type']) ? ' TYPE = ' - . $this->dbh->options['default_table_type'] : ''; + . strlen($this->conn->default_table_type) ? ' TYPE = ' + . $this->conn->default_table_type : ''; $res = $this->conn->exec($query); @@ -334,7 +334,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export return true; $query = 'INSERT INTO ' . $sequenceName - . ' (' . $seqcol_name . ') VALUES (' . ($start-1) . ')'; + . ' (' . $seqcol_name . ') VALUES (' . ($start - 1) . ')'; $res = $this->conn->exec($query); diff --git a/lib/Doctrine/Sequence/Sqlite.php b/lib/Doctrine/Sequence/Sqlite.php index c9cb23313..64dd47491 100644 --- a/lib/Doctrine/Sequence/Sqlite.php +++ b/lib/Doctrine/Sequence/Sqlite.php @@ -40,7 +40,7 @@ class Doctrine_Sequence_Sqlite extends Doctrine_Sequence * * @return integer next id in the given sequence */ - public function nextID($seqName, $onDemand = true) + public function nextId($seqName, $onDemand = true) { $sequenceName = $this->conn->quoteIdentifier($this->conn->getSequenceName($seqName), true); $seqcolName = $this->conn->quoteIdentifier($this->conn->getAttribute(Doctrine::ATTR_SEQCOL_NAME), true); @@ -52,7 +52,7 @@ class Doctrine_Sequence_Sqlite extends Doctrine_Sequence $this->conn->exec($query); } catch(Doctrine_Connection_Exception $e) { - if ($onDemand && $result->getPortableCode() == Doctrine::ERR_NOSUCHTABLE) { + if ($onDemand && $e->getPortableCode() == Doctrine::ERR_NOSUCHTABLE) { // Since we are creating the sequence on demand // we know the first id = 1 so initialize the // sequence at 2 @@ -89,7 +89,7 @@ class Doctrine_Sequence_Sqlite extends Doctrine_Sequence * @param string name of the field into which a new row was inserted * @return integer|boolean */ - public function lastInsertID($table = null, $field = null) + public function lastInsertId($table = null, $field = null) { return $this->conn->getDbh()->lastInsertID(); } @@ -100,7 +100,7 @@ class Doctrine_Sequence_Sqlite extends Doctrine_Sequence * * @return integer current id in the given sequence */ - public function currID($seqName) + public function currId($seqName) { $sequenceName = $this->conn->quoteIdentifier($this->conn->getSequenceName($seqName), true); $seqcolName = $this->conn->quoteIdentifier($this->conn->getAttribute(Doctrine::ATTR_SEQCOL_NAME), true);