[ticket/12747] Drop support for Firebird

PHPBB3-12747
This commit is contained in:
Joas Schilling 2014-06-20 12:35:42 +02:00
parent 70d4ede9b2
commit 04164affe6
26 changed files with 9 additions and 1145 deletions

View file

@ -20,7 +20,6 @@
$schema_path = dirname(__FILE__) . '/../install/schemas/'; $schema_path = dirname(__FILE__) . '/../install/schemas/';
$supported_dbms = array( $supported_dbms = array(
'firebird',
'mssql', 'mssql',
'mysql_40', 'mysql_40',
'mysql_41', 'mysql_41',
@ -67,7 +66,6 @@ foreach ($supported_dbms as $dbms)
{ {
case 'mysql_40': case 'mysql_40':
case 'mysql_41': case 'mysql_41':
case 'firebird':
case 'sqlite': case 'sqlite':
case 'sqlite3': case 'sqlite3':
fwrite($fp, "# DO NOT EDIT THIS FILE, IT IS GENERATED\n"); fwrite($fp, "# DO NOT EDIT THIS FILE, IT IS GENERATED\n");

View file

@ -136,7 +136,6 @@
<li>PostgreSQL 8.3+</li> <li>PostgreSQL 8.3+</li>
<li>SQLite 2.8.2+</li> <li>SQLite 2.8.2+</li>
<li>SQLite 3.6.15+</li> <li>SQLite 3.6.15+</li>
<li>Firebird 2.1+</li>
<li>MS SQL Server 2000 or above (directly or via ODBC or the native adapter)</li> <li>MS SQL Server 2000 or above (directly or via ODBC or the native adapter)</li>
<li>Oracle</li> <li>Oracle</li>
</ul> </ul>

View file

@ -323,7 +323,7 @@
<p>Please remember that running any application on a development (unstable, e.g. a beta release) version of PHP can lead to strange/unexpected results which may appear to be bugs in the application. Therefore, we recommend you upgrade to the newest stable version of PHP before running phpBB3. If you are running a development version of PHP please check any bugs you find on a system running a stable release before submitting.</p> <p>Please remember that running any application on a development (unstable, e.g. a beta release) version of PHP can lead to strange/unexpected results which may appear to be bugs in the application. Therefore, we recommend you upgrade to the newest stable version of PHP before running phpBB3. If you are running a development version of PHP please check any bugs you find on a system running a stable release before submitting.</p>
<p>This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MariaDB 5.x, MSSQL Server 2000, PostgreSQL 8.x, Oracle 8, SQLite 2 and Firebird. Versions of PHP used range from 5.3.x to 5.4.x without problem.</p> <p>This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MariaDB 5.x, MSSQL Server 2000, PostgreSQL 8.x, Oracle 8, SQLite 2 and SQLite 3. Versions of PHP used range from 5.3.x to 5.4.x without problem.</p>
<a name="phpsec"></a><h3>7.i. Notice on PHP security issues</h3> <a name="phpsec"></a><h3>7.i. Notice on PHP security issues</h3>

View file

@ -736,7 +736,7 @@ static private function f()
<a name="sql"></a><h3>2.iii. SQL/SQL Layout</h3> <a name="sql"></a><h3>2.iii. SQL/SQL Layout</h3>
<h4>Common SQL Guidelines: </h4> <h4>Common SQL Guidelines: </h4>
<p>All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL3/4/5, MSSQL (7.0 and 2000), PostgreSQL (8.3+), Firebird, SQLite, Oracle8, ODBC (generalised if possible)).</p> <p>All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL3/4/5, MSSQL (7.0 and 2000), PostgreSQL (8.3+), SQLite, Oracle8, ODBC (generalised if possible)).</p>
<p>All SQL commands should utilise the DataBase Abstraction Layer (DBAL)</p> <p>All SQL commands should utilise the DataBase Abstraction Layer (DBAL)</p>
<h4>SQL code layout:</h4> <h4>SQL code layout:</h4>

View file

@ -119,10 +119,6 @@ class acp_database
case 'mssqlnative': case 'mssqlnative':
$extractor = new mssql_extractor($format, $filename, $time, $download, $store); $extractor = new mssql_extractor($format, $filename, $time, $download, $store);
break; break;
case 'firebird':
$extractor = new firebird_extractor($format, $filename, $time, $download, $store);
break;
} }
$extractor->write_start($table_prefix); $extractor->write_start($table_prefix);
@ -141,7 +137,6 @@ class acp_database
{ {
case 'sqlite': case 'sqlite':
case 'sqlite3': case 'sqlite3':
case 'firebird':
$extractor->flush('DELETE FROM ' . $table_name . ";\n"); $extractor->flush('DELETE FROM ' . $table_name . ";\n");
break; break;
@ -338,20 +333,6 @@ class acp_database
} }
break; break;
case 'firebird':
$delim = ";\n";
while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false)
{
$query = trim($sql);
if (substr($query, 0, 8) === 'SET TERM')
{
$delim = $query[9] . "\n";
continue;
}
$db->sql_query($query);
}
break;
case 'postgres': case 'postgres':
$delim = ";\n"; $delim = ";\n";
while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false) while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false)
@ -2110,235 +2091,6 @@ class oracle_extractor extends base_extractor
} }
} }
class firebird_extractor extends base_extractor
{
function write_start($prefix)
{
$sql_data = "--\n";
$sql_data .= "-- phpBB Backup Script\n";
$sql_data .= "-- Dump of tables for $prefix\n";
$sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n";
$sql_data .= "--\n";
$this->flush($sql_data);
}
function write_data($table_name)
{
global $db;
$ary_type = $ary_name = array();
// Grab all of the data from current table.
$sql = "SELECT *
FROM $table_name";
$result = $db->sql_query($sql);
$i_num_fields = ibase_num_fields($result);
for ($i = 0; $i < $i_num_fields; $i++)
{
$info = ibase_field_info($result, $i);
$ary_type[$i] = $info['type'];
$ary_name[$i] = $info['name'];
}
while ($row = $db->sql_fetchrow($result))
{
$schema_vals = $schema_fields = array();
// Build the SQL statement to recreate the data.
for ($i = 0; $i < $i_num_fields; $i++)
{
$str_val = $row[strtolower($ary_name[$i])];
if (preg_match('#char|text|bool|varbinary|blob#i', $ary_type[$i]))
{
$str_quote = '';
$str_empty = "''";
$str_val = sanitize_data_generic(str_replace("'", "''", $str_val));
}
else if (preg_match('#date|timestamp#i', $ary_type[$i]))
{
if (empty($str_val))
{
$str_quote = '';
}
else
{
$str_quote = "'";
}
}
else
{
$str_quote = '';
$str_empty = 'NULL';
}
if (empty($str_val) && $str_val !== '0')
{
$str_val = $str_empty;
}
$schema_vals[$i] = $str_quote . $str_val . $str_quote;
$schema_fields[$i] = '"' . $ary_name[$i] . '"';
}
// Take the ordered fields and their associated data and build it
// into a valid sql statement to recreate that field in the data.
$sql_data = "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\n";
$this->flush($sql_data);
}
$db->sql_freeresult($result);
}
function write_table($table_name)
{
global $db;
$sql_data = '-- Table: ' . $table_name . "\n";
$sql_data .= "DROP TABLE $table_name;\n";
$data_types = array(7 => 'SMALLINT', 8 => 'INTEGER', 10 => 'FLOAT', 12 => 'DATE', 13 => 'TIME', 14 => 'CHARACTER', 27 => 'DOUBLE PRECISION', 35 => 'TIMESTAMP', 37 => 'VARCHAR', 40 => 'CSTRING', 261 => 'BLOB', 701 => 'DECIMAL', 702 => 'NUMERIC');
$sql_data .= "\nCREATE TABLE $table_name (\n";
$sql = 'SELECT DISTINCT R.RDB$FIELD_NAME as FNAME, R.RDB$NULL_FLAG as NFLAG, R.RDB$DEFAULT_SOURCE as DSOURCE, F.RDB$FIELD_TYPE as FTYPE, F.RDB$FIELD_SUB_TYPE as STYPE, F.RDB$FIELD_LENGTH as FLEN
FROM RDB$RELATION_FIELDS R
JOIN RDB$FIELDS F ON R.RDB$FIELD_SOURCE=F.RDB$FIELD_NAME
LEFT JOIN RDB$FIELD_DIMENSIONS D ON R.RDB$FIELD_SOURCE = D.RDB$FIELD_NAME
WHERE F.RDB$SYSTEM_FLAG = 0
AND R.RDB$RELATION_NAME = \''. $table_name . '\'
ORDER BY R.RDB$FIELD_POSITION';
$result = $db->sql_query($sql);
$rows = array();
while ($row = $db->sql_fetchrow($result))
{
$line = "\t" . '"' . $row['fname'] . '" ' . $data_types[$row['ftype']];
if ($row['ftype'] == 261 && $row['stype'] == 1)
{
$line .= ' SUB_TYPE TEXT';
}
if ($row['ftype'] == 37 || $row['ftype'] == 14)
{
$line .= ' (' . $row['flen'] . ')';
}
if (!empty($row['dsource']))
{
$line .= ' ' . $row['dsource'];
}
if (!empty($row['nflag']))
{
$line .= ' NOT NULL';
}
$rows[] = $line;
}
$db->sql_freeresult($result);
$sql_data .= implode(",\n", $rows);
$sql_data .= "\n);\n";
$keys = array();
$sql = 'SELECT I.RDB$FIELD_NAME as NAME
FROM RDB$RELATION_CONSTRAINTS RC, RDB$INDEX_SEGMENTS I, RDB$INDICES IDX
WHERE (I.RDB$INDEX_NAME = RC.RDB$INDEX_NAME)
AND (IDX.RDB$INDEX_NAME = RC.RDB$INDEX_NAME)
AND (RC.RDB$RELATION_NAME = \''. $table_name . '\')
ORDER BY I.RDB$FIELD_POSITION';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$keys[] = $row['name'];
}
if (sizeof($keys))
{
$sql_data .= "\nALTER TABLE $table_name ADD PRIMARY KEY (" . implode(', ', $keys) . ');';
}
$db->sql_freeresult($result);
$sql = 'SELECT I.RDB$INDEX_NAME as INAME, I.RDB$UNIQUE_FLAG as UFLAG, S.RDB$FIELD_NAME as FNAME
FROM RDB$INDICES I JOIN RDB$INDEX_SEGMENTS S ON S.RDB$INDEX_NAME=I.RDB$INDEX_NAME
WHERE (I.RDB$SYSTEM_FLAG IS NULL OR I.RDB$SYSTEM_FLAG=0)
AND I.RDB$FOREIGN_KEY IS NULL
AND I.RDB$RELATION_NAME = \''. $table_name . '\'
AND I.RDB$INDEX_NAME NOT STARTING WITH \'RDB$\'
ORDER BY S.RDB$FIELD_POSITION';
$result = $db->sql_query($sql);
$index = array();
while ($row = $db->sql_fetchrow($result))
{
$index[$row['iname']]['unique'] = !empty($row['uflag']);
$index[$row['iname']]['values'][] = $row['fname'];
}
foreach ($index as $index_name => $data)
{
$sql_data .= "\nCREATE ";
if ($data['unique'])
{
$sql_data .= 'UNIQUE ';
}
$sql_data .= "INDEX $index_name ON $table_name(" . implode(', ', $data['values']) . ");";
}
$sql_data .= "\n";
$db->sql_freeresult($result);
$sql = 'SELECT D1.RDB$DEPENDENT_NAME as DNAME, D1.RDB$FIELD_NAME as FNAME, D1.RDB$DEPENDENT_TYPE, R1.RDB$RELATION_NAME
FROM RDB$DEPENDENCIES D1
LEFT JOIN RDB$RELATIONS R1 ON ((D1.RDB$DEPENDENT_NAME = R1.RDB$RELATION_NAME) AND (NOT (R1.RDB$VIEW_BLR IS NULL)))
WHERE (D1.RDB$DEPENDED_ON_TYPE = 0)
AND (D1.RDB$DEPENDENT_TYPE <> 3)
AND (D1.RDB$DEPENDED_ON_NAME = \'' . $table_name . '\')
UNION SELECT DISTINCT F2.RDB$RELATION_NAME, D2.RDB$FIELD_NAME, D2.RDB$DEPENDENT_TYPE, R2.RDB$RELATION_NAME FROM RDB$DEPENDENCIES D2, RDB$RELATION_FIELDS F2
LEFT JOIN RDB$RELATIONS R2 ON ((F2.RDB$RELATION_NAME = R2.RDB$RELATION_NAME) AND (NOT (R2.RDB$VIEW_BLR IS NULL)))
WHERE (D2.RDB$DEPENDENT_TYPE = 3)
AND (D2.RDB$DEPENDENT_NAME = F2.RDB$FIELD_SOURCE)
AND (D2.RDB$DEPENDED_ON_NAME = \'' . $table_name . '\')
ORDER BY 1, 2';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$sql = 'SELECT T1.RDB$DEPENDED_ON_NAME as GEN, T1.RDB$FIELD_NAME, T1.RDB$DEPENDED_ON_TYPE
FROM RDB$DEPENDENCIES T1
WHERE (T1.RDB$DEPENDENT_NAME = \'' . $row['dname'] . '\')
AND (T1.RDB$DEPENDENT_TYPE = 2 AND T1.RDB$DEPENDED_ON_TYPE = 14)
UNION ALL SELECT DISTINCT D.RDB$DEPENDED_ON_NAME, D.RDB$FIELD_NAME, D.RDB$DEPENDED_ON_TYPE
FROM RDB$DEPENDENCIES D, RDB$RELATION_FIELDS F
WHERE (D.RDB$DEPENDENT_TYPE = 3)
AND (D.RDB$DEPENDENT_NAME = F.RDB$FIELD_SOURCE)
AND (F.RDB$RELATION_NAME = \'' . $row['dname'] . '\')
ORDER BY 1,2';
$result2 = $db->sql_query($sql);
$row2 = $db->sql_fetchrow($result2);
$db->sql_freeresult($result2);
$gen_name = $row2['gen'];
$sql_data .= "\nDROP GENERATOR " . $gen_name . ";";
$sql_data .= "\nSET TERM ^ ;";
$sql_data .= "\nCREATE GENERATOR " . $gen_name . "^";
$sql_data .= "\nSET GENERATOR " . $gen_name . " TO 0^\n";
$sql_data .= "\nCREATE TRIGGER {$row['dname']} FOR $table_name";
$sql_data .= "\nBEFORE INSERT\nAS\nBEGIN";
$sql_data .= "\n NEW.{$row['fname']} = GEN_ID(" . $gen_name . ", 1);";
$sql_data .= "\nEND^\n";
$sql_data .= "\nSET TERM ; ^\n";
}
$this->flush($sql_data);
$db->sql_freeresult($result);
}
}
// get how much space we allow for a chunk of data, very similar to phpMyAdmin's way of doing things ;-) (hey, we only do this for MySQL anyway :P) // get how much space we allow for a chunk of data, very similar to phpMyAdmin's way of doing things ;-) (hey, we only do this for MySQL anyway :P)
function get_usable_memory() function get_usable_memory()
{ {

View file

@ -542,7 +542,6 @@ class acp_icons
{ {
case 'sqlite': case 'sqlite':
case 'sqlite3': case 'sqlite3':
case 'firebird':
$db->sql_query('DELETE FROM ' . $table); $db->sql_query('DELETE FROM ' . $table);
break; break;

View file

@ -273,7 +273,6 @@ class acp_main
{ {
case 'sqlite': case 'sqlite':
case 'sqlite3': case 'sqlite3':
case 'firebird':
$db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE); $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE);
break; break;
@ -379,7 +378,6 @@ class acp_main
{ {
case 'sqlite': case 'sqlite':
case 'sqlite3': case 'sqlite3':
case 'firebird':
$db->sql_query("DELETE FROM $table"); $db->sql_query("DELETE FROM $table");
break; break;

View file

@ -1267,11 +1267,6 @@ class acp_profile
break; break;
case 'firebird':
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' ADD "' . strtoupper($field_ident) . '" ' . $sql_type;
break;
case 'oracle': case 'oracle':
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD $field_ident " . $sql_type; $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD $field_ident " . $sql_type;

View file

@ -252,7 +252,6 @@ class acp_reasons
// Teh standard // Teh standard
case 'postgres': case 'postgres':
case 'oracle': case 'oracle':
case 'firebird':
case 'sqlite': case 'sqlite':
case 'sqlite3': case 'sqlite3':
// Change the reports using this reason to 'other' // Change the reports using this reason to 'other'

View file

@ -2445,7 +2445,6 @@ function phpbb_cache_moderators($db, $cache, $auth)
{ {
case 'sqlite': case 'sqlite':
case 'sqlite3': case 'sqlite3':
case 'firebird':
$db->sql_query('DELETE FROM ' . MODERATOR_CACHE_TABLE); $db->sql_query('DELETE FROM ' . MODERATOR_CACHE_TABLE);
break; break;
@ -2900,17 +2899,6 @@ function get_database_size()
} }
break; break;
case 'firebird':
global $dbname;
// if it on the local machine, we can get lucky
if (file_exists($dbname))
{
$database_size = filesize($dbname);
}
break;
case 'sqlite': case 'sqlite':
case 'sqlite3': case 'sqlite3':
global $dbhost; global $dbhost;

View file

@ -2045,7 +2045,6 @@ function update_topics_posted()
{ {
case 'sqlite': case 'sqlite':
case 'sqlite3': case 'sqlite3':
case 'firebird':
$db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE); $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE);
break; break;

View file

@ -27,15 +27,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
{ {
global $lang; global $lang;
$available_dbms = array( $available_dbms = array(
'firebird' => array(
'LABEL' => 'FireBird',
'SCHEMA' => 'firebird',
'MODULE' => 'interbase',
'DELIM' => ';;',
'DRIVER' => 'phpbb\db\driver\firebird',
'AVAILABLE' => true,
'2.0.x' => false,
),
// Note: php 5.5 alpha 2 deprecated mysql. // Note: php 5.5 alpha 2 deprecated mysql.
// Keep mysqli before mysql in this list. // Keep mysqli before mysql in this list.
'mysqli' => array( 'mysqli' => array(
@ -260,7 +251,6 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
$prefix_length = 200; $prefix_length = 200;
break; break;
case 'phpbb\db\driver\firebird':
case 'phpbb\db\driver\oracle': case 'phpbb\db\driver\oracle':
$prefix_length = 6; $prefix_length = 6;
break; break;
@ -321,87 +311,6 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
} }
break; break;
case 'phpbb\db\driver\firebird':
// check the version of FB, use some hackery if we can't get access to the server info
if ($db->service_handle !== false && function_exists('ibase_server_info'))
{
$val = @ibase_server_info($db->service_handle, IBASE_SVC_SERVER_VERSION);
preg_match('#V([\d.]+)#', $val, $match);
if ($match[1] < 2)
{
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
}
$db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES);
preg_match('/^\\s*Page size\\s*(\\d+)/m', $db_info, $regs);
$page_size = intval($regs[1]);
if ($page_size < 8192)
{
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS'];
}
}
else
{
$sql = "SELECT *
FROM RDB$FUNCTIONS
WHERE RDB$SYSTEM_FLAG IS NULL
AND RDB$FUNCTION_NAME = 'CHAR_LENGTH'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// if its a UDF, its too old
if ($row)
{
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
}
else
{
$sql = 'SELECT 1 FROM RDB$DATABASE
WHERE BIN_AND(10, 1) = 0';
$result = $db->sql_query($sql);
if (!$result) // This can only fail if BIN_AND is not defined
{
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
}
$db->sql_freeresult($result);
}
// Setup the stuff for our random table
$char_array = array_merge(range('A', 'Z'), range('0', '9'));
$char_len = mt_rand(7, 9);
$char_array_len = sizeof($char_array) - 1;
$final = '';
for ($i = 0; $i < $char_len; $i++)
{
$final .= $char_array[mt_rand(0, $char_array_len)];
}
// Create some random table
$sql = 'CREATE TABLE ' . $final . " (
FIELD1 VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
FIELD2 INTEGER DEFAULT 0 NOT NULL);";
$db->sql_query($sql);
// Create an index that should fail if the page size is less than 8192
$sql = 'CREATE INDEX ' . $final . ' ON ' . $final . '(FIELD1, FIELD2);';
$db->sql_query($sql);
if (ibase_errmsg() !== false)
{
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS'];
}
else
{
// Kill the old table
$db->sql_query('DROP TABLE ' . $final . ';');
}
unset($final);
}
break;
case 'phpbb\db\driver\oracle': case 'phpbb\db\driver\oracle':
if ($unicode_check) if ($unicode_check)
{ {

View file

@ -1360,12 +1360,6 @@ class parse_message extends bbcode_firstpass
ORDER BY LEN(code) DESC'; ORDER BY LEN(code) DESC';
break; break;
case 'firebird':
$sql = 'SELECT *
FROM ' . SMILIES_TABLE . '
ORDER BY CHAR_LENGTH(code) DESC';
break;
// LENGTH supported by MySQL, IBM DB2, Oracle and Access for sure... // LENGTH supported by MySQL, IBM DB2, Oracle and Access for sure...
default: default:
$sql = 'SELECT * $sql = 'SELECT *

View file

@ -1804,13 +1804,6 @@ function phpbb_create_userconv_table()
$drop_sql = 'DROP TABLE ' . USERCONV_TABLE; $drop_sql = 'DROP TABLE ' . USERCONV_TABLE;
switch ($map_dbms) switch ($map_dbms)
{ {
case 'firebird':
$create_sql = 'CREATE TABLE ' . USERCONV_TABLE . ' (
user_id INTEGER NOT NULL,
username_clean VARCHAR(255) CHARACTER SET UTF8 DEFAULT \'\' NOT NULL COLLATE UNICODE
)';
break;
case 'mssql': case 'mssql':
$create_sql = 'CREATE TABLE [' . USERCONV_TABLE . '] ( $create_sql = 'CREATE TABLE [' . USERCONV_TABLE . '] (
[user_id] [int] NOT NULL , [user_id] [int] NOT NULL ,

View file

@ -182,7 +182,7 @@ header('Content-type: text/html; charset=UTF-8');
define('IN_DB_UPDATE', true); define('IN_DB_UPDATE', true);
/** /**
* @todo firebird/mysql update? * @todo mysql update?
*/ */
// End startup code // End startup code

View file

@ -252,7 +252,6 @@ class install_convert extends module
{ {
case 'sqlite': case 'sqlite':
case 'sqlite3': case 'sqlite3':
case 'firebird':
$db->sql_query('DELETE FROM ' . SESSIONS_KEYS_TABLE); $db->sql_query('DELETE FROM ' . SESSIONS_KEYS_TABLE);
$db->sql_query('DELETE FROM ' . SESSIONS_TABLE); $db->sql_query('DELETE FROM ' . SESSIONS_TABLE);
break; break;
@ -700,7 +699,6 @@ class install_convert extends module
{ {
case 'sqlite': case 'sqlite':
case 'sqlite3': case 'sqlite3':
case 'firebird':
$convert->src_truncate_statement = 'DELETE FROM '; $convert->src_truncate_statement = 'DELETE FROM ';
break; break;
@ -733,7 +731,6 @@ class install_convert extends module
{ {
case 'sqlite': case 'sqlite':
case 'sqlite3': case 'sqlite3':
case 'firebird':
$convert->truncate_statement = 'DELETE FROM '; $convert->truncate_statement = 'DELETE FROM ';
break; break;

View file

@ -142,7 +142,6 @@ $lang = array_merge($lang, array(
'DEV_NO_TEST_FILE' => 'No value has been specified for the test_file variable in the convertor. If you are a user of this convertor, you should not be seeing this error, please report this message to the convertor author. If you are a convertor author, you must specify the name of a file which exists in the source board to allow the path to it to be verified.', 'DEV_NO_TEST_FILE' => 'No value has been specified for the test_file variable in the convertor. If you are a user of this convertor, you should not be seeing this error, please report this message to the convertor author. If you are a convertor author, you must specify the name of a file which exists in the source board to allow the path to it to be verified.',
'DIRECTORIES_AND_FILES' => 'Directory and file setup', 'DIRECTORIES_AND_FILES' => 'Directory and file setup',
'DISABLE_KEYS' => 'Disabling keys', 'DISABLE_KEYS' => 'Disabling keys',
'DLL_FIREBIRD' => 'Firebird',
'DLL_FTP' => 'Remote FTP support [ Installation ]', 'DLL_FTP' => 'Remote FTP support [ Installation ]',
'DLL_GD' => 'GD graphics support [ Visual Confirmation ]', 'DLL_GD' => 'GD graphics support [ Visual Confirmation ]',
'DLL_MBSTRING' => 'Multi-byte character support', 'DLL_MBSTRING' => 'Multi-byte character support',
@ -171,8 +170,6 @@ $lang = array_merge($lang, array(
'FILLING_TABLE' => 'Filling table <strong>%s</strong>', 'FILLING_TABLE' => 'Filling table <strong>%s</strong>',
'FILLING_TABLES' => 'Filling tables', 'FILLING_TABLES' => 'Filling tables',
'FIREBIRD_DBMS_UPDATE_REQUIRED' => 'phpBB no longer supports Firebird/Interbase prior to Version 2.1. Please update your Firebird installation to at least 2.1.0 before proceeding with the update.',
'FINAL_STEP' => 'Process final step', 'FINAL_STEP' => 'Process final step',
'FORUM_ADDRESS' => 'Board address', 'FORUM_ADDRESS' => 'Board address',
'FORUM_ADDRESS_EXPLAIN' => 'This is the URL of your former board, for example <samp>http://www.example.com/phpBB2/</samp>. If an address is entered here and not left empty every instance of this address will be replaced by your new board address within messages, private messages and signatures.', 'FORUM_ADDRESS_EXPLAIN' => 'This is the URL of your former board, for example <samp>http://www.example.com/phpBB2/</samp>. If an address is entered here and not left empty every instance of this address will be replaced by your new board address within messages, private messages and signatures.',
@ -216,7 +213,6 @@ $lang = array_merge($lang, array(
<li>PostgreSQL 8.3+</li> <li>PostgreSQL 8.3+</li>
<li>SQLite 2.8.2+</li> <li>SQLite 2.8.2+</li>
<li>SQLite 3.6.15+</li> <li>SQLite 3.6.15+</li>
<li>Firebird 2.1+</li>
<li>MS SQL Server 2000 or above (directly or via ODBC)</li> <li>MS SQL Server 2000 or above (directly or via ODBC)</li>
<li>MS SQL Server 2005 or above (native)</li> <li>MS SQL Server 2005 or above (native)</li>
<li>Oracle</li> <li>Oracle</li>
@ -241,8 +237,6 @@ $lang = array_merge($lang, array(
'INST_ERR_DB_NO_SQLITE' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.', 'INST_ERR_DB_NO_SQLITE' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.',
'INST_ERR_DB_NO_SQLITE3' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 3.6.15.', 'INST_ERR_DB_NO_SQLITE3' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 3.6.15.',
'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on this machine requires you to set the <var>NLS_CHARACTERSET</var> parameter to <var>UTF8</var>. Either upgrade your installation to 9.2+ or change the parameter.', 'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on this machine requires you to set the <var>NLS_CHARACTERSET</var> parameter to <var>UTF8</var>. Either upgrade your installation to 9.2+ or change the parameter.',
'INST_ERR_DB_NO_FIREBIRD' => 'The version of Firebird installed on this machine is older than 2.1, please upgrade to a newer version.',
'INST_ERR_DB_NO_FIREBIRD_PS'=> 'The database you selected for Firebird has a page size less than 8192, it must be at least 8192.',
'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in <var>UNICODE</var> or <var>UTF8</var> encoding. Try installing with a database in <var>UNICODE</var> or <var>UTF8</var> encoding.', 'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in <var>UNICODE</var> or <var>UTF8</var> encoding. Try installing with a database in <var>UNICODE</var> or <var>UTF8</var> encoding.',
'INST_ERR_DB_NO_NAME' => 'No database name specified.', 'INST_ERR_DB_NO_NAME' => 'No database name specified.',
'INST_ERR_EMAIL_INVALID' => 'The email address you entered is invalid.', 'INST_ERR_EMAIL_INVALID' => 'The email address you entered is invalid.',

View file

@ -316,13 +316,6 @@ class service
ORDER BY LEN(bot_agent) DESC'; ORDER BY LEN(bot_agent) DESC';
break; break;
case 'firebird':
$sql = 'SELECT user_id, bot_agent, bot_ip
FROM ' . BOTS_TABLE . '
WHERE bot_active = 1
ORDER BY CHAR_LENGTH(bot_agent) DESC';
break;
// LENGTH supported by MySQL, IBM DB2 and Oracle for sure... // LENGTH supported by MySQL, IBM DB2 and Oracle for sure...
default: default:
$sql = 'SELECT user_id, bot_agent, bot_ip $sql = 'SELECT user_id, bot_agent, bot_ip

View file

@ -1,526 +0,0 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\driver;
/**
* Firebird/Interbase Database Abstraction Layer
* Minimum Requirement is Firebird 2.1
*/
class firebird extends \phpbb\db\driver\driver
{
var $last_query_text = '';
var $service_handle = false;
var $affected_rows = 0;
var $connect_error = '';
/**
* {@inheritDoc}
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->server = $sqlserver . (($port) ? ':' . $port : '');
$this->dbname = str_replace('\\', '/', $database);
// There are three possibilities to connect to an interbase db
if (!$this->server)
{
$use_database = $this->dbname;
}
else if (strpos($this->server, '//') === 0)
{
$use_database = $this->server . $this->dbname;
}
else
{
$use_database = $this->server . ':' . $this->dbname;
}
if ($this->persistency)
{
if (!function_exists('ibase_pconnect'))
{
$this->connect_error = 'ibase_pconnect function does not exist, is interbase extension installed?';
return $this->sql_error('');
}
$this->db_connect_id = @ibase_pconnect($use_database, $this->user, $sqlpassword, false, false, 3);
}
else
{
if (!function_exists('ibase_connect'))
{
$this->connect_error = 'ibase_connect function does not exist, is interbase extension installed?';
return $this->sql_error('');
}
$this->db_connect_id = @ibase_connect($use_database, $this->user, $sqlpassword, false, false, 3);
}
// Do not call ibase_service_attach if connection failed,
// otherwise error message from ibase_(p)connect call will be clobbered.
if ($this->db_connect_id && function_exists('ibase_service_attach') && $this->server)
{
$this->service_handle = @ibase_service_attach($this->server, $this->user, $sqlpassword);
}
else
{
$this->service_handle = false;
}
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
}
/**
* {@inheritDoc}
*/
function sql_server_info($raw = false, $use_cache = true)
{
/**
* force $use_cache false. I didn't research why the caching code there is no caching code
* but I assume its because the IB extension provides a direct method to access it
* without a query.
*/
$use_cache = false;
if ($this->service_handle !== false && function_exists('ibase_server_info'))
{
return @ibase_server_info($this->service_handle, IBASE_SVC_SERVER_VERSION);
}
return ($raw) ? '2.1' : 'Firebird/Interbase';
}
/**
* SQL Transaction
* @access private
*/
function _sql_transaction($status = 'begin')
{
switch ($status)
{
case 'begin':
return true;
break;
case 'commit':
return @ibase_commit();
break;
case 'rollback':
return @ibase_rollback();
break;
}
return true;
}
/**
* {@inheritDoc}
*/
function sql_query($query = '', $cache_ttl = 0)
{
if ($query != '')
{
global $cache;
// EXPLAIN only in extra debug mode
if (defined('DEBUG'))
{
$this->sql_report('start', $query);
}
$this->last_query_text = $query;
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
$this->sql_add_num_queries($this->query_result);
if ($this->query_result === false)
{
$array = array();
// We overcome Firebird's 32767 char limit by binding vars
if (strlen($query) > 32767)
{
if (preg_match('/^(INSERT INTO[^(]++)\\(([^()]+)\\) VALUES[^(]++\\((.*?)\\)$/s', $query, $regs))
{
if (strlen($regs[3]) > 32767)
{
preg_match_all('/\'(?:[^\']++|\'\')*+\'|[\d-.]+/', $regs[3], $vals, PREG_PATTERN_ORDER);
$inserts = $vals[0];
unset($vals);
foreach ($inserts as $key => $value)
{
if (!empty($value) && $value[0] === "'" && strlen($value) > 32769) // check to see if this thing is greater than the max + 'x2
{
$inserts[$key] = '?';
$array[] = str_replace("''", "'", substr($value, 1, -1));
}
}
$query = $regs[1] . '(' . $regs[2] . ') VALUES (' . implode(', ', $inserts) . ')';
}
}
else if (preg_match('/^(UPDATE ([\\w_]++)\\s+SET )([\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|\\d+)(?:,\\s*[\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+))*+)\\s+(WHERE.*)$/s', $query, $data))
{
if (strlen($data[3]) > 32767)
{
$update = $data[1];
$where = $data[4];
preg_match_all('/(\\w++)\\s*=\\s*(\'(?:[^\']++|\'\')*+\'|[\d-.]++)/', $data[3], $temp, PREG_SET_ORDER);
unset($data);
$cols = array();
foreach ($temp as $value)
{
if (!empty($value[2]) && $value[2][0] === "'" && strlen($value[2]) > 32769) // check to see if this thing is greater than the max + 'x2
{
$array[] = str_replace("''", "'", substr($value[2], 1, -1));
$cols[] = $value[1] . '=?';
}
else
{
$cols[] = $value[1] . '=' . $value[2];
}
}
$query = $update . implode(', ', $cols) . ' ' . $where;
unset($cols);
}
}
}
if (!function_exists('ibase_affected_rows') && (preg_match('/^UPDATE ([\w_]++)\s+SET [\w_]++\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+)(?:,\s*[\w_]++\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+))*+\s+(WHERE.*)?$/s', $query, $regs) || preg_match('/^DELETE FROM ([\w_]++)\s*(WHERE\s*.*)?$/s', $query, $regs)))
{
$affected_sql = 'SELECT COUNT(*) as num_rows_affected FROM ' . $regs[1];
if (!empty($regs[2]))
{
$affected_sql .= ' ' . $regs[2];
}
if (!($temp_q_id = @ibase_query($this->db_connect_id, $affected_sql)))
{
return false;
}
$temp_result = @ibase_fetch_assoc($temp_q_id);
@ibase_free_result($temp_q_id);
$this->affected_rows = ($temp_result) ? $temp_result['NUM_ROWS_AFFECTED'] : false;
}
if (sizeof($array))
{
$p_query = @ibase_prepare($this->db_connect_id, $query);
array_unshift($array, $p_query);
$this->query_result = call_user_func_array('ibase_execute', $array);
unset($array);
if ($this->query_result === false)
{
$this->sql_error($query);
}
}
else if (($this->query_result = @ibase_query($this->db_connect_id, $query)) === false)
{
$this->sql_error($query);
}
if (defined('DEBUG'))
{
$this->sql_report('stop', $query);
}
if (!$this->transaction)
{
if (function_exists('ibase_commit_ret'))
{
@ibase_commit_ret();
}
else
{
// way cooler than ibase_commit_ret :D
@ibase_query('COMMIT RETAIN;');
}
}
if ($cache && $cache_ttl)
{
$this->open_queries[(int) $this->query_result] = $this->query_result;
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
}
else if (strpos($query, 'SELECT') === 0 && $this->query_result)
{
$this->open_queries[(int) $this->query_result] = $this->query_result;
}
}
else if (defined('DEBUG'))
{
$this->sql_report('fromcache', $query);
}
}
else
{
return false;
}
return $this->query_result;
}
/**
* Build LIMIT query
*/
function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
{
$this->query_result = false;
$query = 'SELECT FIRST ' . $total . ((!empty($offset)) ? ' SKIP ' . $offset : '') . substr($query, 6);
return $this->sql_query($query, $cache_ttl);
}
/**
* {@inheritDoc}
*/
function sql_affectedrows()
{
// PHP 5+ function
if (function_exists('ibase_affected_rows'))
{
return ($this->db_connect_id) ? @ibase_affected_rows($this->db_connect_id) : false;
}
else
{
return $this->affected_rows;
}
}
/**
* {@inheritDoc}
*/
function sql_fetchrow($query_id = false)
{
global $cache;
if ($query_id === false)
{
$query_id = $this->query_result;
}
if ($cache && $cache->sql_exists($query_id))
{
return $cache->sql_fetchrow($query_id);
}
if ($query_id === false)
{
return false;
}
$row = array();
$cur_row = @ibase_fetch_object($query_id, IBASE_TEXT);
if (!$cur_row)
{
return false;
}
foreach (get_object_vars($cur_row) as $key => $value)
{
$row[strtolower($key)] = (is_string($value)) ? trim(str_replace(array("\\0", "\\n"), array("\0", "\n"), $value)) : $value;
}
return (sizeof($row)) ? $row : false;
}
/**
* {@inheritDoc}
*/
function sql_nextid()
{
$query_id = $this->query_result;
if ($query_id !== false && $this->last_query_text != '')
{
if ($this->query_result && preg_match('#^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)#i', $this->last_query_text, $tablename))
{
$sql = 'SELECT GEN_ID(' . $tablename[1] . '_gen, 0) AS new_id FROM RDB$DATABASE';
if (!($temp_q_id = @ibase_query($this->db_connect_id, $sql)))
{
return false;
}
$temp_result = @ibase_fetch_assoc($temp_q_id);
@ibase_free_result($temp_q_id);
return ($temp_result) ? $temp_result['NEW_ID'] : false;
}
}
return false;
}
/**
* {@inheritDoc}
*/
function sql_freeresult($query_id = false)
{
global $cache;
if ($query_id === false)
{
$query_id = $this->query_result;
}
if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
{
return $cache->sql_freeresult($query_id);
}
if (isset($this->open_queries[(int) $query_id]))
{
unset($this->open_queries[(int) $query_id]);
return @ibase_free_result($query_id);
}
return false;
}
/**
* {@inheritDoc}
*/
function sql_escape($msg)
{
return str_replace(array("'", "\0"), array("''", ''), $msg);
}
/**
* Build LIKE expression
* @access private
*/
function _sql_like_expression($expression)
{
return $expression . " ESCAPE '\\'";
}
/**
* Build db-specific query data
* @access private
*/
function _sql_custom_build($stage, $data)
{
return $data;
}
function _sql_bit_and($column_name, $bit, $compare = '')
{
return 'BIN_AND(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : '');
}
function _sql_bit_or($column_name, $bit, $compare = '')
{
return 'BIN_OR(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : '');
}
/**
* {@inheritDoc}
*/
function cast_expr_to_bigint($expression)
{
// Precision must be from 1 to 18
return 'CAST(' . $expression . ' as DECIMAL(18, 0))';
}
/**
* {@inheritDoc}
*/
function cast_expr_to_string($expression)
{
return 'CAST(' . $expression . ' as VARCHAR(255))';
}
/**
* return sql error array
* @access private
*/
function _sql_error()
{
// Need special handling here because ibase_errmsg returns
// connection errors, however if the interbase extension
// is not installed then ibase_errmsg does not exist and
// we cannot call it.
if (function_exists('ibase_errmsg'))
{
$msg = @ibase_errmsg();
if (!$msg)
{
$msg = $this->connect_error;
}
}
else
{
$msg = $this->connect_error;
}
return array(
'message' => $msg,
'code' => (@function_exists('ibase_errcode') ? @ibase_errcode() : '')
);
}
/**
* Close sql connection
* @access private
*/
function _sql_close()
{
if ($this->service_handle !== false)
{
@ibase_service_detach($this->service_handle);
}
return @ibase_close($this->db_connect_id);
}
/**
* Build db-specific report
* @access private
*/
function _sql_report($mode, $query = '')
{
switch ($mode)
{
case 'start':
break;
case 'fromcache':
$endtime = explode(' ', microtime());
$endtime = $endtime[0] + $endtime[1];
$result = @ibase_query($this->db_connect_id, $query);
while ($void = @ibase_fetch_object($result, IBASE_TEXT))
{
// Take the time spent on parsing rows into account
}
@ibase_free_result($result);
$splittime = explode(' ', microtime());
$splittime = $splittime[0] + $splittime[1];
$this->sql_report('record_fromcache', $query, $endtime, $splittime);
break;
}
}
}

View file

@ -109,36 +109,6 @@ class tools
'VARBINARY' => 'varbinary(255)', 'VARBINARY' => 'varbinary(255)',
), ),
'firebird' => array(
'INT:' => 'INTEGER',
'BINT' => 'DOUBLE PRECISION',
'UINT' => 'INTEGER',
'UINT:' => 'INTEGER',
'TINT:' => 'INTEGER',
'USINT' => 'INTEGER',
'BOOL' => 'INTEGER',
'VCHAR' => 'VARCHAR(255) CHARACTER SET NONE',
'VCHAR:' => 'VARCHAR(%d) CHARACTER SET NONE',
'CHAR:' => 'CHAR(%d) CHARACTER SET NONE',
'XSTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
'STEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
'TEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
'MTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
'XSTEXT_UNI'=> 'VARCHAR(100) CHARACTER SET UTF8',
'STEXT_UNI' => 'VARCHAR(255) CHARACTER SET UTF8',
'TEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8',
'MTEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8',
'TIMESTAMP' => 'INTEGER',
'DECIMAL' => 'DOUBLE PRECISION',
'DECIMAL:' => 'DOUBLE PRECISION',
'PDECIMAL' => 'DOUBLE PRECISION',
'PDECIMAL:' => 'DOUBLE PRECISION',
'VCHAR_UNI' => 'VARCHAR(255) CHARACTER SET UTF8',
'VCHAR_UNI:'=> 'VARCHAR(%d) CHARACTER SET UTF8',
'VCHAR_CI' => 'VARCHAR(255) CHARACTER SET UTF8',
'VARBINARY' => 'CHAR(255) CHARACTER SET NONE',
),
'mssql' => array( 'mssql' => array(
'INT:' => '[int]', 'INT:' => '[int]',
'BINT' => '[float]', 'BINT' => '[float]',
@ -331,7 +301,7 @@ class tools
* A list of supported DBMS. We change this class to support more DBMS, the DBMS itself only need to follow some rules. * A list of supported DBMS. We change this class to support more DBMS, the DBMS itself only need to follow some rules.
* @var array * @var array
*/ */
var $supported_dbms = array('firebird', 'mssql', 'mssqlnative', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite', 'sqlite3'); var $supported_dbms = array('mssql', 'mssqlnative', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite', 'sqlite3');
/** /**
* This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array). * This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array).
@ -441,13 +411,6 @@ class tools
FROM pg_stat_user_tables'; FROM pg_stat_user_tables';
break; break;
case 'firebird':
$sql = 'SELECT rdb$relation_name
FROM rdb$relations
WHERE rdb$view_source is null
AND rdb$system_flag = 0';
break;
case 'oracle': case 'oracle':
$sql = 'SELECT table_name $sql = 'SELECT table_name
FROM USER_TABLES'; FROM USER_TABLES';
@ -580,7 +543,6 @@ class tools
// Close the table for two DBMS and add to the statements // Close the table for two DBMS and add to the statements
switch ($this->sql_layer) switch ($this->sql_layer)
{ {
case 'firebird':
case 'mssql': case 'mssql':
case 'mssqlnative': case 'mssqlnative':
$table_sql .= "\n);"; $table_sql .= "\n);";
@ -610,7 +572,6 @@ class tools
$table_sql .= ",\n\t PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')'; $table_sql .= ",\n\t PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')';
break; break;
case 'firebird':
case 'mssql': case 'mssql':
case 'mssqlnative': case 'mssqlnative':
// We need the data here // We need the data here
@ -685,19 +646,6 @@ class tools
$statements[] = $trigger; $statements[] = $trigger;
} }
break; break;
case 'firebird':
if ($create_sequence)
{
$statements[] = "CREATE GENERATOR {$table_name}_gen;";
$statements[] = "SET GENERATOR {$table_name}_gen TO 0;";
$trigger = "CREATE TRIGGER t_$table_name FOR $table_name\n";
$trigger .= "BEFORE INSERT\nAS\nBEGIN\n";
$trigger .= "\tNEW.{$create_sequence} = GEN_ID({$table_name}_gen, 1);\nEND;";
$statements[] = $trigger;
}
break;
} }
// Write Keys // Write Keys
@ -1174,12 +1122,6 @@ class tools
WHERE LOWER(table_name) = '" . strtolower($table) . "'"; WHERE LOWER(table_name) = '" . strtolower($table) . "'";
break; break;
case 'firebird':
$sql = "SELECT RDB\$FIELD_NAME as FNAME
FROM RDB\$RELATION_FIELDS
WHERE RDB\$RELATION_NAME = '" . strtoupper($table) . "'";
break;
case 'sqlite': case 'sqlite':
case 'sqlite3': case 'sqlite3':
$sql = "SELECT sql $sql = "SELECT sql
@ -1278,15 +1220,6 @@ class tools
switch ($this->sql_layer) switch ($this->sql_layer)
{ {
case 'firebird':
$sql = "SELECT LOWER(RDB\$INDEX_NAME) as index_name
FROM RDB\$INDICES
WHERE RDB\$RELATION_NAME = '" . strtoupper($table_name) . "'
AND RDB\$UNIQUE_FLAG IS NULL
AND RDB\$FOREIGN_KEY IS NULL";
$col = 'index_name';
break;
case 'postgres': case 'postgres':
$sql = "SELECT ic.relname as index_name $sql = "SELECT ic.relname as index_name
FROM pg_class bc, pg_class ic, pg_index i FROM pg_class bc, pg_class ic, pg_index i
@ -1332,7 +1265,6 @@ class tools
// These DBMS prefix index name with the table name // These DBMS prefix index name with the table name
switch ($this->sql_layer) switch ($this->sql_layer)
{ {
case 'firebird':
case 'oracle': case 'oracle':
case 'postgres': case 'postgres':
case 'sqlite': case 'sqlite':
@ -1385,15 +1317,6 @@ class tools
switch ($this->sql_layer) switch ($this->sql_layer)
{ {
case 'firebird':
$sql = "SELECT LOWER(RDB\$INDEX_NAME) as index_name
FROM RDB\$INDICES
WHERE RDB\$RELATION_NAME = '" . strtoupper($table_name) . "'
AND RDB\$UNIQUE_FLAG IS NOT NULL
AND RDB\$FOREIGN_KEY IS NULL";
$col = 'index_name';
break;
case 'postgres': case 'postgres':
$sql = "SELECT ic.relname as index_name, i.indisunique $sql = "SELECT ic.relname as index_name, i.indisunique
FROM pg_class bc, pg_class ic, pg_index i FROM pg_class bc, pg_class ic, pg_index i
@ -1460,7 +1383,6 @@ class tools
} }
break; break;
case 'firebird':
case 'postgres': case 'postgres':
case 'sqlite': case 'sqlite':
case 'sqlite3': case 'sqlite3':
@ -1536,32 +1458,6 @@ class tools
switch ($this->sql_layer) switch ($this->sql_layer)
{ {
case 'firebird':
$sql .= " {$column_type} ";
$return_array['column_type_sql_type'] = " {$column_type} ";
if (!is_null($column_data[1]))
{
$sql .= 'DEFAULT ' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ' ';
$return_array['column_type_sql_default'] = ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ' ';
}
$sql .= 'NOT NULL';
// This is a UNICODE column and thus should be given it's fair share
if (preg_match('/^X?STEXT_UNI|VCHAR_(CI|UNI:?)/', $column_data[0]))
{
$sql .= ' COLLATE UNICODE';
}
$return_array['auto_increment'] = false;
if (isset($column_data[2]) && $column_data[2] == 'auto_increment')
{
$return_array['auto_increment'] = true;
}
break;
case 'mssql': case 'mssql':
case 'mssqlnative': case 'mssqlnative':
$sql .= " {$column_type} "; $sql .= " {$column_type} ";
@ -1772,11 +1668,6 @@ class tools
switch ($this->sql_layer) switch ($this->sql_layer)
{ {
case 'firebird':
// Does not support AFTER statement, only POSITION (and there you need the column position)
$statements[] = 'ALTER TABLE ' . $table_name . ' ADD "' . strtoupper($column_name) . '" ' . $column_data['column_type_sql'];
break;
case 'mssql': case 'mssql':
case 'mssqlnative': case 'mssqlnative':
// Does not support AFTER, only through temporary table // Does not support AFTER, only through temporary table
@ -1894,10 +1785,6 @@ class tools
switch ($this->sql_layer) switch ($this->sql_layer)
{ {
case 'firebird':
$statements[] = 'ALTER TABLE ' . $table_name . ' DROP "' . strtoupper($column_name) . '"';
break;
case 'mssql': case 'mssql':
case 'mssqlnative': case 'mssqlnative':
// We need the data here // We need the data here
@ -2036,7 +1923,6 @@ class tools
$statements[] = 'DROP INDEX ' . $index_name . ' ON ' . $table_name; $statements[] = 'DROP INDEX ' . $index_name . ' ON ' . $table_name;
break; break;
case 'firebird':
case 'oracle': case 'oracle':
case 'postgres': case 'postgres':
case 'sqlite': case 'sqlite':
@ -2065,21 +1951,6 @@ class tools
switch ($this->sql_layer) switch ($this->sql_layer)
{ {
case 'firebird':
$sql = 'SELECT RDB$GENERATOR_NAME as gen
FROM RDB$GENERATORS
WHERE RDB$SYSTEM_FLAG = 0
AND RDB$GENERATOR_NAME = \'' . strtoupper($table_name) . "_GEN'";
$result = $this->db->sql_query($sql);
// does a generator exist?
if ($row = $this->db->sql_fetchrow($result))
{
$statements[] = "DROP GENERATOR {$row['gen']};";
}
$this->db->sql_freeresult($result);
break;
case 'oracle': case 'oracle':
$sql = 'SELECT A.REFERENCED_NAME $sql = 'SELECT A.REFERENCED_NAME
FROM USER_DEPENDENCIES A, USER_TRIGGERS B FROM USER_DEPENDENCIES A, USER_TRIGGERS B
@ -2125,7 +1996,6 @@ class tools
switch ($this->sql_layer) switch ($this->sql_layer)
{ {
case 'firebird':
case 'postgres': case 'postgres':
case 'mysql_40': case 'mysql_40':
case 'mysql_41': case 'mysql_41':
@ -2217,7 +2087,6 @@ class tools
switch ($this->sql_layer) switch ($this->sql_layer)
{ {
case 'firebird':
case 'postgres': case 'postgres':
case 'oracle': case 'oracle':
case 'sqlite': case 'sqlite':
@ -2261,7 +2130,6 @@ class tools
switch ($this->sql_layer) switch ($this->sql_layer)
{ {
case 'firebird':
case 'postgres': case 'postgres':
case 'oracle': case 'oracle':
case 'sqlite': case 'sqlite':
@ -2320,15 +2188,6 @@ class tools
{ {
switch ($this->sql_layer) switch ($this->sql_layer)
{ {
case 'firebird':
$sql = "SELECT LOWER(RDB\$INDEX_NAME) as index_name
FROM RDB\$INDICES
WHERE RDB\$RELATION_NAME = '" . strtoupper($table_name) . "'
AND RDB\$UNIQUE_FLAG IS NULL
AND RDB\$FOREIGN_KEY IS NULL";
$col = 'index_name';
break;
case 'postgres': case 'postgres':
$sql = "SELECT ic.relname as index_name $sql = "SELECT ic.relname as index_name
FROM pg_class bc, pg_class ic, pg_index i FROM pg_class bc, pg_class ic, pg_index i
@ -2373,7 +2232,6 @@ class tools
switch ($this->sql_layer) switch ($this->sql_layer)
{ {
case 'firebird':
case 'oracle': case 'oracle':
case 'postgres': case 'postgres':
case 'sqlite': case 'sqlite':
@ -2400,20 +2258,6 @@ class tools
switch ($this->sql_layer) switch ($this->sql_layer)
{ {
case 'firebird':
// Change type...
if (!empty($column_data['column_type_sql_default']))
{
$statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN "' . strtoupper($column_name) . '" TYPE ' . ' ' . $column_data['column_type_sql_type'];
$statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN "' . strtoupper($column_name) . '" SET DEFAULT ' . ' ' . $column_data['column_type_sql_default'];
}
else
{
// TODO: try to change pkey without removing trigger, generator or constraints. ATM this query may fail.
$statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN "' . strtoupper($column_name) . '" TYPE ' . ' ' . $column_data['column_type_sql_type'];
}
break;
case 'mssql': case 'mssql':
case 'mssqlnative': case 'mssqlnative':
// We need the data here // We need the data here

View file

@ -1485,7 +1485,6 @@ class fulltext_native extends \phpbb\search\base
{ {
case 'sqlite': case 'sqlite':
case 'sqlite3': case 'sqlite3':
case 'firebird':
$this->db->sql_query('DELETE FROM ' . SEARCH_WORDLIST_TABLE); $this->db->sql_query('DELETE FROM ' . SEARCH_WORDLIST_TABLE);
$this->db->sql_query('DELETE FROM ' . SEARCH_WORDMATCH_TABLE); $this->db->sql_query('DELETE FROM ' . SEARCH_WORDMATCH_TABLE);
$this->db->sql_query('DELETE FROM ' . SEARCH_RESULTS_TABLE); $this->db->sql_query('DELETE FROM ' . SEARCH_RESULTS_TABLE);

View file

@ -32,7 +32,6 @@ will be skipped:
- apc (APC cache driver) - apc (APC cache driver)
- bz2 (compress tests) - bz2 (compress tests)
- interbase, pdo_firebird (Firebird database driver)
- mysql, pdo_mysql (MySQL database driver) - mysql, pdo_mysql (MySQL database driver)
- mysqli, pdo_mysql (MySQLi database driver) - mysqli, pdo_mysql (MySQLi database driver)
- pcntl (flock class) - pcntl (flock class)
@ -82,16 +81,10 @@ Special Database Cases
---------------------- ----------------------
In order to run tests on some of the databases that we support, it will be In order to run tests on some of the databases that we support, it will be
necessary to provide a custom DSN string in test_config.php. This is only necessary to provide a custom DSN string in test_config.php. This is only
needed for MSSQL 2000+ (PHP module), MSSQL via ODBC, and Firebird when needed for MSSQL 2000+ (PHP module) and MSSQL via ODBC. The variable must be
PDO_Firebird does not work on your system named `$custom_dsn`.
(https://bugs.php.net/bug.php?id=61183). The variable must be named `$custom_dsn`.
Examples: Example MSSQL:
Firebird using http://www.firebirdsql.org/en/odbc-driver/
$custom_dsn = "Driver={Firebird/InterBase(r) driver};dbname=$dbhost:$dbname";
MSSQL
$custom_dsn = "Driver={SQL Server Native Client 10.0};Server=$dbhost;Database=$dbname"; $custom_dsn = "Driver={SQL Server Native Client 10.0};Server=$dbhost;Database=$dbname";

View file

@ -18,7 +18,6 @@ class phpbb_convert_30_dbms_to_31_test extends phpbb_test_case
public function convert_30_dbms_to_31_data() public function convert_30_dbms_to_31_data()
{ {
return array( return array(
array('firebird'),
array('mssql'), array('mssql'),
array('mssql_odbc'), array('mssql_odbc'),
array('mssqlnative'), array('mssqlnative'),

View file

@ -25,7 +25,7 @@ if (!class_exists('PDO'))
*/ */
class phpbb_database_connection_odbc_pdo_wrapper extends PDO class phpbb_database_connection_odbc_pdo_wrapper extends PDO
{ {
// Name of the driver being used (i.e. mssql, firebird) // Name of the driver being used (i.e. mssql)
public $driver = ''; public $driver = '';
// Version number of driver since PDO::getAttribute(PDO::ATTR_CLIENT_VERSION) is pretty useless for this // Version number of driver since PDO::getAttribute(PDO::ATTR_CLIENT_VERSION) is pretty useless for this

View file

@ -145,25 +145,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
public function createXMLDataSet($path) public function createXMLDataSet($path)
{ {
$db_config = $this->get_database_config();
// Firebird requires table and column names to be uppercase
if ($db_config['dbms'] == 'phpbb\db\driver\firebird')
{
$xml_data = file_get_contents($path);
$xml_data = preg_replace_callback('/(?:(<table name="))([a-z_]+)(?:(">))/', 'phpbb_database_test_case::to_upper', $xml_data);
$xml_data = preg_replace_callback('/(?:(<column>))([a-z_]+)(?:(<\/column>))/', 'phpbb_database_test_case::to_upper', $xml_data);
$new_fixture = tmpfile();
fwrite($new_fixture, $xml_data);
fseek($new_fixture, 0);
$meta_data = stream_get_meta_data($new_fixture);
$path = $meta_data['uri'];
}
$this->fixture_xml_data = parent::createXMLDataSet($path); $this->fixture_xml_data = parent::createXMLDataSet($path);
return $this->fixture_xml_data; return $this->fixture_xml_data;
} }
@ -246,7 +228,6 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
/** /**
* Converts a match in the middle of a string to uppercase. * Converts a match in the middle of a string to uppercase.
* This is necessary for transforming the fixture information for Firebird tests
* *
* @param $matches The array of matches from a regular expression * @param $matches The array of matches from a regular expression
* *

View file

@ -116,7 +116,7 @@ class phpbb_database_test_connection_manager
// These require different connection strings on the phpBB side than they do in PDO // These require different connection strings on the phpBB side than they do in PDO
// so you must provide a DSN string for ODBC separately // so you must provide a DSN string for ODBC separately
if (!empty($this->config['custom_dsn']) && ($this->config['dbms'] == 'phpbb\db\driver\mssql' || $this->config['dbms'] == 'phpbb\db\driver\firebird')) if (!empty($this->config['custom_dsn']) && $this->config['dbms'] == 'phpbb\db\driver\mssql')
{ {
$dsn = 'odbc:' . $this->config['custom_dsn']; $dsn = 'odbc:' . $this->config['custom_dsn'];
} }
@ -130,14 +130,6 @@ class phpbb_database_test_connection_manager
$this->pdo = new phpbb_database_connection_odbc_pdo_wrapper('mssql', 0, $dsn, $this->config['dbuser'], $this->config['dbpasswd']); $this->pdo = new phpbb_database_connection_odbc_pdo_wrapper('mssql', 0, $dsn, $this->config['dbuser'], $this->config['dbpasswd']);
break; break;
case 'phpbb\db\driver\firebird':
if (!empty($this->config['custom_dsn']))
{
$this->pdo = new phpbb_database_connection_odbc_pdo_wrapper('firebird', 0, $dsn, $this->config['dbuser'], $this->config['dbpasswd']);
break;
}
// Fall through if they're using the firebird PDO driver and not the generic ODBC driver
default: default:
$this->pdo = new PDO($dsn, $this->config['dbuser'], $this->config['dbpasswd']); $this->pdo = new PDO($dsn, $this->config['dbuser'], $this->config['dbpasswd']);
break; break;
@ -197,7 +189,6 @@ class phpbb_database_test_connection_manager
{ {
case 'phpbb\db\driver\sqlite': case 'phpbb\db\driver\sqlite':
case 'phpbb\db\driver\sqlite3': case 'phpbb\db\driver\sqlite3':
case 'phpbb\db\driver\firebird':
$this->connect(); $this->connect();
// Drop all of the tables // Drop all of the tables
foreach ($this->get_tables() as $table) foreach ($this->get_tables() as $table)
@ -298,13 +289,6 @@ class phpbb_database_test_connection_manager
FROM pg_stat_user_tables'; FROM pg_stat_user_tables';
break; break;
case 'phpbb\db\driver\firebird':
$sql = 'SELECT rdb$relation_name
FROM rdb$relations
WHERE rdb$view_source is null
AND rdb$system_flag = 0';
break;
case 'phpbb\db\driver\oracle': case 'phpbb\db\driver\oracle':
$sql = 'SELECT table_name $sql = 'SELECT table_name
FROM USER_TABLES'; FROM USER_TABLES';
@ -404,11 +388,6 @@ class phpbb_database_test_connection_manager
protected function get_dbms_data($dbms) protected function get_dbms_data($dbms)
{ {
$available_dbms = array( $available_dbms = array(
'phpbb\db\driver\firebird' => array(
'SCHEMA' => 'firebird',
'DELIM' => ';;',
'PDO' => 'firebird',
),
'phpbb\db\driver\mysqli' => array( 'phpbb\db\driver\mysqli' => array(
'SCHEMA' => 'mysql_41', 'SCHEMA' => 'mysql_41',
'DELIM' => ';', 'DELIM' => ';',
@ -478,18 +457,6 @@ class phpbb_database_test_connection_manager
switch ($this->config['dbms']) switch ($this->config['dbms'])
{ {
case 'phpbb\db\driver\firebird':
$sql = 'SELECT RDB$GENERATOR_NAME
FROM RDB$GENERATORS
WHERE RDB$SYSTEM_FLAG = 0';
$result = $this->pdo->query($sql);
while ($row = $result->fetch(PDO::FETCH_NUM))
{
$queries[] = 'DROP GENERATOR ' . current($row);
}
break;
case 'phpbb\db\driver\oracle': case 'phpbb\db\driver\oracle':
$sql = 'SELECT sequence_name $sql = 'SELECT sequence_name
FROM USER_SEQUENCES'; FROM USER_SEQUENCES';