Commit 67985484 authored by Benjamin Eberlei's avatar Benjamin Eberlei

DDC-1502 - Add support for prefixed database table names in SQLite by replacing the . with __

parent e692ab66
...@@ -291,6 +291,7 @@ class SqlitePlatform extends AbstractPlatform ...@@ -291,6 +291,7 @@ class SqlitePlatform extends AbstractPlatform
*/ */
protected function _getCreateTableSQL($name, array $columns, array $options = array()) protected function _getCreateTableSQL($name, array $columns, array $options = array())
{ {
$name = str_replace(".", "__", $name);
$queryFields = $this->getColumnDeclarationListSQL($columns); $queryFields = $this->getColumnDeclarationListSQL($columns);
$autoinc = false; $autoinc = false;
...@@ -338,16 +339,19 @@ class SqlitePlatform extends AbstractPlatform ...@@ -338,16 +339,19 @@ class SqlitePlatform extends AbstractPlatform
public function getListTableConstraintsSQL($table) 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"; return "SELECT sql FROM sqlite_master WHERE type='index' AND tbl_name = '$table' AND sql NOT NULL ORDER BY name";
} }
public function getListTableColumnsSQL($table, $currentDatabase = null) public function getListTableColumnsSQL($table, $currentDatabase = null)
{ {
$table = str_replace(".", "__", $table);
return "PRAGMA table_info($table)"; return "PRAGMA table_info($table)";
} }
public function getListTableIndexesSQL($table, $currentDatabase = null) public function getListTableIndexesSQL($table, $currentDatabase = null)
{ {
$table = str_replace(".", "__", $table);
return "PRAGMA index_list($table)"; return "PRAGMA index_list($table)";
} }
...@@ -411,6 +415,7 @@ class SqlitePlatform extends AbstractPlatform ...@@ -411,6 +415,7 @@ class SqlitePlatform extends AbstractPlatform
*/ */
public function getTruncateTableSQL($tableName, $cascade = false) public function getTruncateTableSQL($tableName, $cascade = false)
{ {
$tableName = str_replace(".", "__", $tableName);
return 'DELETE FROM '.$tableName; return 'DELETE FROM '.$tableName;
} }
...@@ -500,4 +505,10 @@ class SqlitePlatform extends AbstractPlatform ...@@ -500,4 +505,10 @@ class SqlitePlatform extends AbstractPlatform
{ {
return 'BLOB'; return 'BLOB';
} }
public function getTemporaryTableName($tableName)
{
$tableName = str_replace(".", "__", $tableName);
return $tableName;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment