From 0c560d73f978bd51e3fdddac87b7082d5221d6a4 Mon Sep 17 00:00:00 2001 From: zYne Date: Tue, 19 Jun 2007 11:10:13 +0000 Subject: [PATCH] --- lib/Doctrine/Export/Firebird.php | 16 +++++++++++++--- lib/Doctrine/Export/Sqlite.php | 3 ++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/Export/Firebird.php b/lib/Doctrine/Export/Firebird.php index 0eff4a6df..78bc8de17 100644 --- a/lib/Doctrine/Export/Firebird.php +++ b/lib/Doctrine/Export/Firebird.php @@ -502,16 +502,26 @@ class Doctrine_Export_Firebird extends Doctrine_Export * 'charset' => 'utf8', * 'collate' => 'utf8_unicode_ci', * ); - * @return string + * @return boolean */ public function createSequence($seqName, $start = 1, array $options = array()) { $sequenceName = $this->conn->formatter->getSequenceName($seqName); $this->conn->exec('CREATE GENERATOR ' . $sequenceName); - $this->conn->exec('SET GENERATOR ' . $sequenceName . ' TO ' . ($start-1)); - $this->dropSequence($seqName); + try { + $this->conn->exec('SET GENERATOR ' . $sequenceName . ' TO ' . ($start-1)); + + return true; + } catch (Doctrine_Connection_Exception $e) { + try { + $this->dropSequence($seqName); + } catch(Doctrine_Connection_Exception $e) { + throw new Doctrine_Export_Exception('Could not drop inconsistent sequence table'); + } + } + throw new Doctrine_Export_Exception('could not create sequence table'); } /** * drop existing sequence diff --git a/lib/Doctrine/Export/Sqlite.php b/lib/Doctrine/Export/Sqlite.php index c5ac7297b..d70ab3ecf 100644 --- a/lib/Doctrine/Export/Sqlite.php +++ b/lib/Doctrine/Export/Sqlite.php @@ -292,7 +292,8 @@ class Doctrine_Export_Sqlite extends Doctrine_Export $this->conn->exec('INSERT INTO ' . $sequenceName . ' (' . $seqcolName . ') VALUES (' . ($start-1) . ')'); return true; } catch(Doctrine_Connection_Exception $e) { - // Handle error + // Handle error + try { $result = $db->exec('DROP TABLE ' . $sequenceName); } catch(Doctrine_Connection_Exception $e) {