mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-24 08:10:13 +02:00
fix db tools (list_index) and add simpler statements for Sqlite3
git-svn-id: file:///svn/phpbb/trunk@9346 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
d181f0ef36
commit
e7fbdafd7c
@ -728,6 +728,8 @@ class phpbb_db_tools
|
||||
break;
|
||||
|
||||
case 'sqlite':
|
||||
if (version_compare(sqlite_libversion(), '3.0') == -1)
|
||||
{
|
||||
$sql = "SELECT sql
|
||||
FROM sqlite_master
|
||||
WHERE type = 'table'
|
||||
@ -776,6 +778,11 @@ class phpbb_db_tools
|
||||
$statements[] = 'DROP TABLE ' . $table_name . '_temp';
|
||||
|
||||
$statements[] = 'commit';
|
||||
}
|
||||
else
|
||||
{
|
||||
$statements[] = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' [' . $column_data['column_type_sql'] . ']';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -816,6 +823,8 @@ class phpbb_db_tools
|
||||
break;
|
||||
|
||||
case 'sqlite':
|
||||
if (version_compare(sqlite_libversion(), '3.0') == -1)
|
||||
{
|
||||
$sql = "SELECT sql
|
||||
FROM sqlite_master
|
||||
WHERE type = 'table'
|
||||
@ -864,6 +873,11 @@ class phpbb_db_tools
|
||||
$statements[] = 'DROP TABLE ' . $table_name . '_temp';
|
||||
|
||||
$statements[] = 'commit';
|
||||
}
|
||||
else
|
||||
{
|
||||
$statements[] = 'ALTER TABLE ' . $table_name . ' DROP COLUMN ' . $column_name;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1159,6 +1173,7 @@ class phpbb_db_tools
|
||||
FROM user_indexes
|
||||
WHERE table_name = '" . $table_name . "'
|
||||
AND generated = 'N'";
|
||||
$col = 'index_name';
|
||||
break;
|
||||
|
||||
case 'sqlite':
|
||||
@ -1430,6 +1445,38 @@ class phpbb_db_tools
|
||||
{
|
||||
$column_type = sprintf($this->db->dbms_type_map[$orig_column_type . ':'], $column_length);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($this->db->dbms_type_map[$orig_column_type . ':']['rule']))
|
||||
{
|
||||
switch ($this->db->dbms_type_map[$orig_column_type . ':']['rule'][0])
|
||||
{
|
||||
case 'div':
|
||||
$column_length /= $this->db->dbms_type_map[$orig_column_type . ':']['rule'][1];
|
||||
$column_length = ceil($column_length);
|
||||
$column_type = sprintf($this->db->dbms_type_map[$orig_column_type . ':'][0], $column_length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->db->dbms_type_map[$orig_column_type . ':']['limit']))
|
||||
{
|
||||
switch ($this->db->dbms_type_map[$orig_column_type . ':']['limit'][0])
|
||||
{
|
||||
case 'mult':
|
||||
$column_length *= $this->db->dbms_type_map[$orig_column_type . ':']['limit'][1];
|
||||
if ($column_length > $this->db->dbms_type_map[$orig_column_type . ':']['limit'][2])
|
||||
{
|
||||
$column_type = $this->db->dbms_type_map[$orig_column_type . ':']['limit'][3];
|
||||
}
|
||||
else
|
||||
{
|
||||
$column_type = sprintf($this->db->dbms_type_map[$orig_column_type . ':'][0], $column_length);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$orig_column_type .= ':';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user