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

MDB2 porting continues

This commit is contained in:
zYne 2007-06-13 21:37:33 +00:00
parent d9678357aa
commit 1a14aa301d
2 changed files with 46 additions and 7 deletions

View File

@ -70,13 +70,13 @@ class Doctrine_Export_Pgsql extends Doctrine_Export
{
$query = '';
if (isset($definition['match'])) {
$query .= ' MATCH '.$definition['match'];
$query .= ' MATCH ' . $definition['match'];
}
if (isset($definition['onUpdate'])) {
$query .= ' ON UPDATE '.$definition['on_update'];
$query .= ' ON UPDATE ' . $definition['on_update'];
}
if (isset($definition['onDelete'])) {
$query .= ' ON DELETE '.$definition['on_delete'];
$query .= ' ON DELETE ' . $definition['on_delete'];
}
if (isset($definition['deferrable'])) {
$query .= ' DEFERRABLE';

View File

@ -213,14 +213,53 @@ class Doctrine_Export_Sqlite extends Doctrine_Export
throw $e;
}
}
/**
* getAdvancedForeignKeyOptions
* Return the FOREIGN KEY query section dealing with non-standard options
* as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
*
* @param array $definition foreign key definition
* @return string
* @access protected
*/
public function getAdvancedForeignKeyOptions(array $definition)
{
$query = '';
if (isset($definition['match'])) {
$query .= ' MATCH ' . $definition['match'];
}
if (isset($definition['onUpdate'])) {
$query .= ' ON UPDATE ' . $definition['on_update'];
}
if (isset($definition['onDelete'])) {
$query .= ' ON DELETE ' . $definition['on_delete'];
}
if (isset($definition['deferrable'])) {
$query .= ' DEFERRABLE';
} else {
$query .= ' NOT DEFERRABLE';
}
if (isset($definition['feferred'])) {
$query .= ' INITIALLY DEFERRED';
} else {
$query .= ' INITIALLY IMMEDIATE';
}
return $query;
}
/**
* create sequence
*
* @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 boolean
*/
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->getAttribute(Doctrine::ATTR_SEQCOL_NAME), true);
@ -248,12 +287,12 @@ class Doctrine_Export_Sqlite extends Doctrine_Export
/**
* drop existing sequence
*
* @param string $seq_name name of the sequence to be dropped
* @param string $sequenceName name of the sequence to be dropped
* @return boolean
*/
public function dropSequence($seq_name)
public function dropSequence($sequenceName)
{
$sequenceName = $this->conn->quoteIdentifier($this->conn->getSequenceName($seq_name), true);
$sequenceName = $this->conn->quoteIdentifier($this->conn->getSequenceName($sequenceName), true);
return $this->conn->exec('DROP TABLE ' . $sequenceName);
}
}