Skip to content

Commit

Permalink
Fixed CS in SqlitePlatform
Browse files Browse the repository at this point in the history
  • Loading branch information
hason committed Nov 21, 2012
1 parent 2a057e9 commit d679eb9
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
Expand Up @@ -327,13 +327,19 @@ public function getClobTypeDeclarationSQL(array $field)
return 'CLOB';
}

/**
* {@inheritDoc}
*/
public function getListTableConstraintsSQL($table)
{
$table = str_replace('.', '__', $table);

return "SELECT sql FROM sqlite_master WHERE type='index' AND tbl_name = '$table' AND sql NOT NULL ORDER BY name";
}

/**
* {@inheritDoc}
*/
public function getListTableColumnsSQL($table, $currentDatabase = null)
{
$table = str_replace('.', '__', $table);
Expand All @@ -351,6 +357,9 @@ public function getListTableIndexesSQL($table, $currentDatabase = null)
return "PRAGMA index_list($table)";
}

/**
* {@inheritDoc}
*/
public function getListTablesSQL()
{
return "SELECT name FROM sqlite_master WHERE type = 'table' AND name != 'sqlite_sequence' AND name != 'geometry_columns' AND name != 'spatial_ref_sys' "
Expand All @@ -366,11 +375,17 @@ public function getListViewsSQL($database)
return "SELECT name, sql FROM sqlite_master WHERE type='view' AND sql NOT NULL";
}

/**
* {@inheritDoc}
*/
public function getCreateViewSQL($name, $sql)
{
return 'CREATE VIEW ' . $name . ' AS ' . $sql;
}

/**
* {@inheritDoc}
*/
public function getDropViewSQL($name)
{
return 'DROP VIEW '. $name;
Expand All @@ -383,21 +398,15 @@ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey
{
$query = parent::getAdvancedForeignKeyOptionsSQL($foreignKey);

if ($foreignKey->hasOption('deferrable') && $foreignKey->getOption('deferrable') !== false) {
$query .= ' DEFERRABLE';
} else {
$query .= ' NOT DEFERRABLE';
}

if ($foreignKey->hasOption('deferred') && $foreignKey->getOption('deferred') !== false) {
$query .= ' INITIALLY DEFERRED';
} else {
$query .= ' INITIALLY IMMEDIATE';
}
$query .= (($foreignKey->hasOption('deferrable') && $foreignKey->getOption('deferrable') !== false) ? ' ' : ' NOT ') . 'DEFERRABLE';
$query .= ' INITIALLY ' . (($foreignKey->hasOption('deferred') && $foreignKey->getOption('deferred') !== false) ? 'DEFERRED' : 'IMMEDIATE');

return $query;
}

/**
* {@inheritDoc}
*/
public function supportsIdentityColumns()
{
return true;
Expand Down Expand Up @@ -463,6 +472,9 @@ static public function udfLocate($str, $substr, $offset = 0)
return 0;
}

/**
* {@inheritDoc}
*/
public function getForUpdateSql()
{
return '';
Expand Down

0 comments on commit d679eb9

Please sign in to comment.