Minor fixes
This commit is contained in:
parent
2bdb6860c9
commit
0bafdb6694
@ -161,7 +161,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
|||||||
* @param string $start start value of the sequence; default is 1
|
* @param string $start start value of the sequence; default is 1
|
||||||
* @return void
|
* @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.');
|
throw new Doctrine_Export_Exception('Create sequence not supported by this driver.');
|
||||||
}
|
}
|
||||||
|
@ -320,13 +320,13 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
|||||||
* @param string $start start value of the sequence; default is 1
|
* @param string $start start value of the sequence; default is 1
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function createSequence($sequenceName, $seqcol_name, $start = 1)
|
public function createSequence($sequenceName, $seqcolName, $start = 1)
|
||||||
{
|
{
|
||||||
$query = 'CREATE TABLE ' . $sequenceName
|
$query = 'CREATE TABLE ' . $sequenceName
|
||||||
. ' (' . $seqcol_name . ' INT NOT NULL AUTO_INCREMENT, PRIMARY KEY ('
|
. ' (' . $seqcolName . ' INT NOT NULL AUTO_INCREMENT, PRIMARY KEY ('
|
||||||
. $seqcol_name . '))'
|
. $seqcol_name . '))'
|
||||||
. strlen($this->dbh->options['default_table_type']) ? ' TYPE = '
|
. strlen($this->conn->default_table_type) ? ' TYPE = '
|
||||||
. $this->dbh->options['default_table_type'] : '';
|
. $this->conn->default_table_type : '';
|
||||||
|
|
||||||
$res = $this->conn->exec($query);
|
$res = $this->conn->exec($query);
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
$query = 'INSERT INTO ' . $sequenceName
|
$query = 'INSERT INTO ' . $sequenceName
|
||||||
. ' (' . $seqcol_name . ') VALUES (' . ($start-1) . ')';
|
. ' (' . $seqcol_name . ') VALUES (' . ($start - 1) . ')';
|
||||||
|
|
||||||
$res = $this->conn->exec($query);
|
$res = $this->conn->exec($query);
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class Doctrine_Sequence_Sqlite extends Doctrine_Sequence
|
|||||||
*
|
*
|
||||||
* @return integer next id in the given 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);
|
$sequenceName = $this->conn->quoteIdentifier($this->conn->getSequenceName($seqName), true);
|
||||||
$seqcolName = $this->conn->quoteIdentifier($this->conn->getAttribute(Doctrine::ATTR_SEQCOL_NAME), 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);
|
$this->conn->exec($query);
|
||||||
|
|
||||||
} catch(Doctrine_Connection_Exception $e) {
|
} 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
|
// Since we are creating the sequence on demand
|
||||||
// we know the first id = 1 so initialize the
|
// we know the first id = 1 so initialize the
|
||||||
// sequence at 2
|
// 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
|
* @param string name of the field into which a new row was inserted
|
||||||
* @return integer|boolean
|
* @return integer|boolean
|
||||||
*/
|
*/
|
||||||
public function lastInsertID($table = null, $field = null)
|
public function lastInsertId($table = null, $field = null)
|
||||||
{
|
{
|
||||||
return $this->conn->getDbh()->lastInsertID();
|
return $this->conn->getDbh()->lastInsertID();
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ class Doctrine_Sequence_Sqlite extends Doctrine_Sequence
|
|||||||
*
|
*
|
||||||
* @return integer current id in the given 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);
|
$sequenceName = $this->conn->quoteIdentifier($this->conn->getSequenceName($seqName), true);
|
||||||
$seqcolName = $this->conn->quoteIdentifier($this->conn->getAttribute(Doctrine::ATTR_SEQCOL_NAME), true);
|
$seqcolName = $this->conn->quoteIdentifier($this->conn->getAttribute(Doctrine::ATTR_SEQCOL_NAME), true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user