1
0
mirror of synced 2025-01-18 22:41:43 +03:00

E_STRICT fixes

This commit is contained in:
zYne 2007-06-13 22:31:15 +00:00
parent f8134df165
commit d1a1697a5f
5 changed files with 91 additions and 33 deletions

View File

@ -65,9 +65,21 @@ class Doctrine_Export extends Doctrine_Connection_Module
* @return void
*/
public function dropIndex($table, $name)
{
return $this->conn->exec($this->dropIndexSql($table, $name));
}
/**
* dropIndexSql
*
* @param string $table name of table that should be used in method
* @param string $name name of the index to be dropped
* @return string SQL that is used for dropping an index
*/
public function dropIndexSql($table, $name)
{
$name = $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name));
return $this->conn->exec('DROP INDEX ' . $name);
return 'DROP INDEX ' . $name;
}
/**
* drop existing constraint
@ -84,13 +96,27 @@ class Doctrine_Export extends Doctrine_Connection_Module
return $this->conn->exec('ALTER TABLE ' . $table . ' DROP CONSTRAINT ' . $name);
}
/**
* dropSequenceSql
* drop existing sequence
* (this method is implemented by the drivers)
*
* @param string $seq_name name of the sequence to be dropped
* @throws Doctrine_Connection_Exception if something fails at database level
* @param string $sequenceName name of the sequence to be dropped
* @return void
*/
public function dropSequence($name)
public function dropSequence($sequenceName)
{
$this->conn->exec($this->dropSequenceSql($sequenceName));
}
/**
* dropSequenceSql
* drop existing sequence
*
* @throws Doctrine_Connection_Exception if something fails at database level
* @param string $sequenceName name of the sequence to be dropped
* @return void
*/
public function dropSequenceSql($sequenceName)
{
throw new Doctrine_Export_Exception('Drop sequence not supported by this driver.');
}
@ -184,18 +210,26 @@ class Doctrine_Export extends Doctrine_Connection_Module
/**
* create sequence
*
* @throws Doctrine_Connection_Exception if something fails at database level
* @param string $seqName name of the sequence to be created
* @param string $start start value of the sequence; default is 1
* @param array $options An associative array of table options:
* array(
* 'comment' => 'Foo',
* 'charset' => 'utf8',
* 'collate' => 'utf8_unicode_ci',
* );
* @return void
*/
public function createSequence($seqName, $start = 1)
public function createSequence($seqName, $start = 1, array $options = array())
{
return $this->conn->execute($this->createSequenceSql($seqName, $start = 1));
return $this->conn->execute($this->createSequenceSql($seqName, $start = 1, $options));
}
/**
* return RDBMS specific create sequence statement
* (this method is implemented by the drivers)
*
* @throws Doctrine_Connection_Exception if something fails at database level
* @param string $seqName name of the sequence to be created
* @param string $start start value of the sequence; default is 1
* @param array $options An associative array of table options:

View File

@ -498,14 +498,19 @@ class Doctrine_Export_Firebird extends Doctrine_Export
*
* @param string $seqName name of the sequence to be created
* @param string $start start value of the sequence; default is 1
* @return void
* @param array $options An associative array of table options:
* array(
* 'comment' => 'Foo',
* 'charset' => 'utf8',
* 'collate' => 'utf8_unicode_ci',
* );
* @return string
*/
public function createSequence($seqName, $start = 1)
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);
@ -516,12 +521,12 @@ class Doctrine_Export_Firebird extends Doctrine_Export
* @param string $seqName name of the sequence to be dropped
* @return void
*/
public function dropSequence($seqName)
public function dropSequenceSql($seqName)
{
$sequenceName = $this->conn->formatter->getSequenceName($seqName);
$sequenceName = $this->conn->quote($sequenceName);
$query = "DELETE FROM RDB\$GENERATORS WHERE UPPER(RDB\$GENERATOR_NAME)=" . $sequenceName;
return $this->conn->exec($query);
return $query;
}
}

View File

@ -208,16 +208,22 @@ class Doctrine_Export_Mssql extends Doctrine_Export
/**
* create sequence
*
* @param string $seqName name of the sequence to be created
* @param string $start start value of the sequence; default is 1
* @return void
* @param string $seqName name of the sequence to be created
* @param string $start start value of the sequence; default is 1
* @param array $options An associative array of table options:
* array(
* 'comment' => 'Foo',
* 'charset' => 'utf8',
* 'collate' => 'utf8_unicode_ci',
* );
* @return string
*/
public function createSequence($seqName, $start = 1)
public function createSequence($seqName, $start = 1, array $options = array())
{
$sequenceName = $this->conn->quoteIdentifier($this->conn->getSequenceName($seqName), true);
$seqcolName = $this->conn->quoteIdentifier($this->conn->options['seqcol_name'], true);
$query = 'CREATE TABLE ' . $sequenceName . ' (' . $seqcolName .
' INT PRIMARY KEY CLUSTERED IDENTITY(' . $start . ',1) NOT NULL)';
$query = 'CREATE TABLE ' . $sequenceName . ' (' . $seqcolName .
' INT PRIMARY KEY CLUSTERED IDENTITY(' . $start . ', 1) NOT NULL)';
$res = $this->conn->exec($query);
@ -240,9 +246,9 @@ class Doctrine_Export_Mssql extends Doctrine_Export
* @param string $seqName name of the sequence to be dropped
* @return void
*/
public function dropSequence($seqName)
public function dropSequenceSql($seqName)
{
$sequenceName = $this->conn->quoteIdentifier($this->conn->getSequenceName($seqName), true);
return $this->conn->exec('DROP TABLE ' . $sequenceName);
return 'DROP TABLE ' . $sequenceName;
}
}

View File

@ -432,28 +432,33 @@ END;
/**
* create sequence
*
* @param object $this->conn database object that is extended by this class
* @param string $seqName name of the sequence to be created
* @param string $start start value of the sequence; default is 1
* @return void
* @param array $options An associative array of table options:
* array(
* 'comment' => 'Foo',
* 'charset' => 'utf8',
* 'collate' => 'utf8_unicode_ci',
* );
* @return string
*/
public function createSequence($seqName, $start = 1)
public function createSequenceSql($seqName, $start = 1, array $options = array())
{
$sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true);
$query = 'CREATE SEQUENCE ' . $sequenceName . ' START WITH ' . $start . ' INCREMENT BY 1 NOCACHE';
$query.= ($start < 1 ? ' MINVALUE ' . $start : '');
return $this->conn->exec($query);
$query = 'CREATE SEQUENCE ' . $sequenceName . ' START WITH ' . $start . ' INCREMENT BY 1 NOCACHE';
$query .= ($start < 1 ? ' MINVALUE ' . $start : '');
return $query;
}
/**
* drop existing sequence
*
* @param object $this->conn database object that is extended by this class
* @param string $seqName name of the sequence to be dropped
* @return void
* @return string
*/
public function dropSequence($seqName)
public function dropSequenceSql($seqName)
{
$sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true);
return $this->conn->exec('DROP SEQUENCE ' . $sequenceName);
return 'DROP SEQUENCE ' . $sequenceName;
}
}

View File

@ -251,12 +251,20 @@ class Doctrine_Export_Pgsql extends Doctrine_Export
}
}
/**
* create sequence
* return RDBMS specific create sequence statement
*
* @param string $sequenceName name of the sequence to be created
* @param string $start start value of the sequence; default is 1
* @throws Doctrine_Connection_Exception if something fails at database level
* @param string $seqName name of the sequence to be created
* @param string $start start value of the sequence; default is 1
* @param array $options An associative array of table options:
* array(
* 'comment' => 'Foo',
* 'charset' => 'utf8',
* 'collate' => 'utf8_unicode_ci',
* );
* @return string
*/
public function createSequence($sequenceName, $start = 1)
public function createSequenceSql($sequenceName, $start = 1, array $options = array())
{
$sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($sequenceName), true);
return $this->conn->exec('CREATE SEQUENCE ' . $sequenceName . ' INCREMENT 1' .
@ -267,10 +275,10 @@ class Doctrine_Export_Pgsql extends Doctrine_Export
*
* @param string $sequenceName name of the sequence to be dropped
*/
public function dropSequence($sequenceName)
public function dropSequenceSql($sequenceName)
{
$sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($sequenceName), true);
return $this->conn->exec('DROP SEQUENCE ' . $sequenceName);
return 'DROP SEQUENCE ' . $sequenceName;
}
}