aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/config/services.yml5
-rw-r--r--phpBB/develop/add_permissions.php2
-rw-r--r--phpBB/develop/benchmark.php2
-rw-r--r--phpBB/develop/merge_attachment_tables.php2
-rw-r--r--phpBB/develop/merge_post_tables.php4
-rw-r--r--phpBB/download/file.php5
-rw-r--r--phpBB/includes/acp/acp_database.php28
-rw-r--r--phpBB/includes/acp/acp_forums.php2
-rw-r--r--phpBB/includes/acp/acp_icons.php2
-rw-r--r--phpBB/includes/acp/acp_main.php4
-rw-r--r--phpBB/includes/acp/acp_permission_roles.php6
-rw-r--r--phpBB/includes/acp/acp_permissions.php2
-rw-r--r--phpBB/includes/acp/acp_profile.php4
-rw-r--r--phpBB/includes/acp/acp_prune.php4
-rw-r--r--phpBB/includes/acp/acp_reasons.php2
-rw-r--r--phpBB/includes/acp/acp_users.php4
-rw-r--r--phpBB/includes/acp/auth.php2
-rw-r--r--phpBB/includes/functions.php4
-rw-r--r--phpBB/includes/functions_admin.php16
-rw-r--r--phpBB/includes/functions_container.php14
-rw-r--r--phpBB/includes/functions_convert.php4
-rw-r--r--phpBB/includes/functions_install.php2
-rw-r--r--phpBB/includes/message_parser.php2
-rw-r--r--phpBB/install/convertors/functions_phpbb20.php8
-rw-r--r--phpBB/install/database_update.php2
-rw-r--r--phpBB/install/index.php2
-rw-r--r--phpBB/install/install_convert.php16
-rw-r--r--phpBB/install/install_install.php32
-rw-r--r--phpBB/memberlist.php12
-rw-r--r--phpBB/phpbb/auth/auth.php4
-rw-r--r--phpBB/phpbb/cache/service.php2
-rw-r--r--phpBB/phpbb/db/driver/driver.php96
-rw-r--r--phpBB/phpbb/db/driver/driver_interface.php84
-rw-r--r--phpBB/phpbb/db/driver/factory.php435
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php2
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php2
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php2
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php2
-rw-r--r--phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php2
-rw-r--r--phpBB/phpbb/db/migration/data/v310/postgres_fulltext_drop.php2
-rw-r--r--phpBB/phpbb/db/migration/migration.php6
-rw-r--r--phpBB/phpbb/db/migrator.php2
-rw-r--r--phpBB/phpbb/db/sql_insert_buffer.php2
-rw-r--r--phpBB/phpbb/db/tools.php8
-rw-r--r--phpBB/phpbb/log/log.php2
-rw-r--r--phpBB/phpbb/search/base.php4
-rw-r--r--phpBB/phpbb/search/fulltext_mysql.php8
-rw-r--r--phpBB/phpbb/search/fulltext_native.php10
-rw-r--r--phpBB/phpbb/search/fulltext_postgres.php8
-rw-r--r--phpBB/phpbb/search/fulltext_sphinx.php6
-rw-r--r--phpBB/search.php8
-rw-r--r--phpBB/viewonline.php2
-rw-r--r--tests/dbal/order_lower_test.php2
-rw-r--r--tests/dbal/select_test.php4
-rw-r--r--tests/dbal/sql_insert_buffer_test.php8
55 files changed, 764 insertions, 143 deletions
diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml
index 31f0b9ad95..735a49c99b 100644
--- a/phpBB/config/services.yml
+++ b/phpBB/config/services.yml
@@ -139,6 +139,11 @@ services:
- @service_container
dbal.conn:
+ class: phpbb\db\driver\factory
+ arguments:
+ - @service_container
+
+ dbal.conn.driver:
class: %dbal.driver.class%
calls:
- [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]]
diff --git a/phpBB/develop/add_permissions.php b/phpBB/develop/add_permissions.php
index 7639256cfd..fd419a7dde 100644
--- a/phpBB/develop/add_permissions.php
+++ b/phpBB/develop/add_permissions.php
@@ -371,7 +371,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
switch ($sql_type)
{
case 'insert':
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'mysql':
case 'mysql4':
diff --git a/phpBB/develop/benchmark.php b/phpBB/develop/benchmark.php
index 27176c97d3..c3cf90773e 100644
--- a/phpBB/develop/benchmark.php
+++ b/phpBB/develop/benchmark.php
@@ -313,7 +313,7 @@ function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $m
else
{
// Rollback
- if($db->sql_layer == "mysql")
+ if($db->get_sql_layer() == "mysql")
{
$sql = "DELETE FROM " . POSTS_TABLE . "
WHERE post_id = $new_post_id";
diff --git a/phpBB/develop/merge_attachment_tables.php b/phpBB/develop/merge_attachment_tables.php
index a23db829e5..dd6e12172e 100644
--- a/phpBB/develop/merge_attachment_tables.php
+++ b/phpBB/develop/merge_attachment_tables.php
@@ -48,7 +48,7 @@ $sql = "CREATE TABLE {$table_prefix}attachments
AND a.post_id = p.post_id";
$db->sql_query($sql);
-switch ($db->sql_layer)
+switch ($db->get_sql_layer())
{
case 'mysql':
case 'mysql4':
diff --git a/phpBB/develop/merge_post_tables.php b/phpBB/develop/merge_post_tables.php
index 700c509782..9e81917108 100644
--- a/phpBB/develop/merge_post_tables.php
+++ b/phpBB/develop/merge_post_tables.php
@@ -46,7 +46,7 @@ $sql = "CREATE TABLE {$table_prefix}posts
WHERE pt.post_id = p.post_id";
$db->sql_query($sql);
-switch ($db->sql_layer)
+switch ($db->get_sql_layer())
{
case 'mysql':
case 'mysql4':
@@ -142,7 +142,7 @@ while ($row = $db->sql_fetchrow($result))
}
$db->sql_freeresult($result);
-switch ($db->sql_layer)
+switch ($db->get_sql_layer())
{
case 'oracle':
$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index f7636b0e1a..abafeee667 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -75,11 +75,6 @@ if (isset($_GET['avatar']))
$db = $phpbb_container->get('dbal.conn');
$phpbb_log = $phpbb_container->get('log');
- // Connect to DB
- if (!@$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false))
- {
- exit;
- }
unset($dbpasswd);
request_var('', 0, false, false, $request);
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index 76da43341d..8f9c155ffc 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -90,7 +90,7 @@ class acp_database
$time = time();
$filename = 'backup_' . $time . '_' . unique_id();
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'mysqli':
case 'mysql4':
@@ -133,7 +133,7 @@ class acp_database
else
{
// We might wanna empty out all that junk :D
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'sqlite':
case 'sqlite3':
@@ -320,7 +320,7 @@ class acp_database
break;
}
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'mysql':
case 'mysql4':
@@ -365,10 +365,10 @@ class acp_database
{
trigger_error($user->lang['RESTORE_FAILURE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
- pg_put_line($db->db_connect_id, $sub . "\n");
+ pg_put_line($db->get_db_connect_id(), $sub . "\n");
}
- pg_put_line($db->db_connect_id, "\\.\n");
- pg_end_copy($db->db_connect_id);
+ pg_put_line($db->get_db_connect_id(), "\\.\n");
+ pg_end_copy($db->get_db_connect_id());
}
}
break;
@@ -623,7 +623,7 @@ class mysql_extractor extends base_extractor
if ($new_extract === null)
{
- if ($db->sql_layer === 'mysqli' || version_compare($db->sql_server_info(true), '3.23.20', '>='))
+ if ($db->get_sql_layer() === 'mysqli' || version_compare($db->sql_server_info(true), '3.23.20', '>='))
{
$new_extract = true;
}
@@ -646,7 +646,7 @@ class mysql_extractor extends base_extractor
function write_data($table_name)
{
global $db;
- if ($db->sql_layer === 'mysqli')
+ if ($db->get_sql_layer() === 'mysqli')
{
$this->write_data_mysqli($table_name);
}
@@ -661,7 +661,7 @@ class mysql_extractor extends base_extractor
global $db;
$sql = "SELECT *
FROM $table_name";
- $result = mysqli_query($db->db_connect_id, $sql, MYSQLI_USE_RESULT);
+ $result = mysqli_query($db->get_db_connect_id(), $sql, MYSQLI_USE_RESULT);
if ($result != false)
{
$fields_cnt = mysqli_num_fields($result);
@@ -740,7 +740,7 @@ class mysql_extractor extends base_extractor
global $db;
$sql = "SELECT *
FROM $table_name";
- $result = mysql_unbuffered_query($sql, $db->db_connect_id);
+ $result = mysql_unbuffered_query($sql, $db->get_db_connect_id());
if ($result != false)
{
@@ -993,11 +993,11 @@ class sqlite_extractor extends base_extractor
{
global $db;
- $col_types = sqlite_fetch_column_types($db->db_connect_id, $table_name);
+ $col_types = sqlite_fetch_column_types($db->get_db_connect_id(), $table_name);
$sql = "SELECT *
FROM $table_name";
- $result = sqlite_unbuffered_query($db->db_connect_id, $sql);
+ $result = sqlite_unbuffered_query($db->get_db_connect_id(), $sql);
$rows = sqlite_fetch_all($result, SQLITE_ASSOC);
$sql_insert = 'INSERT INTO ' . $table_name . ' (' . implode(', ', array_keys($col_types)) . ') VALUES (';
foreach ($rows as $row)
@@ -1553,11 +1553,11 @@ class mssql_extractor extends base_extractor
{
global $db;
- if ($db->sql_layer === 'mssql')
+ if ($db->get_sql_layer() === 'mssql')
{
$this->write_data_mssql($table_name);
}
- else if($db->sql_layer === 'mssqlnative')
+ else if($db->get_sql_layer() === 'mssqlnative')
{
$this->write_data_mssqlnative($table_name);
}
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index f8c463e158..adf5de44f5 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -1827,7 +1827,7 @@ class acp_forums
}
$db->sql_freeresult($result);
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'mysql4':
case 'mysqli':
diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php
index b9a6ef17ce..028025b547 100644
--- a/phpBB/includes/acp/acp_icons.php
+++ b/phpBB/includes/acp/acp_icons.php
@@ -538,7 +538,7 @@ class acp_icons
// The user has already selected a smilies_pak file
if ($current == 'delete')
{
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'sqlite':
case 'sqlite3':
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index 247460ec8e..0d0d49774c 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -269,7 +269,7 @@ class acp_main
break;
case 'db_track':
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'sqlite':
case 'sqlite3':
@@ -374,7 +374,7 @@ class acp_main
foreach ($tables as $table)
{
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'sqlite':
case 'sqlite3':
diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php
index 9715b9bce8..cd3616208d 100644
--- a/phpBB/includes/acp/acp_permission_roles.php
+++ b/phpBB/includes/acp/acp_permission_roles.php
@@ -253,7 +253,7 @@ class acp_permission_roles
{
$sql = 'SELECT auth_option_id, auth_option
FROM ' . ACL_OPTIONS_TABLE . "
- WHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char) . "
+ WHERE auth_option " . $db->sql_like_expression($permission_type . $db->get_any_char()) . "
AND auth_option <> '{$permission_type}'
ORDER BY auth_option_id";
$result = $db->sql_query($sql);
@@ -315,7 +315,7 @@ class acp_permission_roles
// We need to fill the auth options array with ACL_NO options ;)
$sql = 'SELECT auth_option_id, auth_option
FROM ' . ACL_OPTIONS_TABLE . "
- WHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char) . "
+ WHERE auth_option " . $db->sql_like_expression($permission_type . $db->get_any_char()) . "
AND auth_option <> '{$permission_type}'
ORDER BY auth_option_id";
$result = $db->sql_query($sql);
@@ -519,7 +519,7 @@ class acp_permission_roles
// Get complete auth array
$sql = 'SELECT auth_option, auth_option_id
FROM ' . ACL_OPTIONS_TABLE . "
- WHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char);
+ WHERE auth_option " . $db->sql_like_expression($permission_type . $db->get_any_char());
$result = $db->sql_query($sql);
$auth_settings = array();
diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php
index 6540173433..cb408e304f 100644
--- a/phpBB/includes/acp/acp_permissions.php
+++ b/phpBB/includes/acp/acp_permissions.php
@@ -1238,7 +1238,7 @@ class acp_permissions
$sql = 'SELECT auth_option_id
FROM ' . ACL_OPTIONS_TABLE . '
- WHERE auth_option ' . $db->sql_like_expression($permission_type . $db->any_char);
+ WHERE auth_option ' . $db->sql_like_expression($permission_type . $db->get_any_char());
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index c291ee43c8..fda6ef25ec 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -112,7 +112,7 @@ class acp_profile
$db->sql_query('DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . " WHERE field_id = $field_id");
$db->sql_query('DELETE FROM ' . PROFILE_LANG_TABLE . " WHERE field_id = $field_id");
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'sqlite':
case 'sqlite3':
@@ -1196,7 +1196,7 @@ class acp_profile
{
global $db;
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'mysql':
case 'mysql4':
diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php
index 2ddda28afc..a10b248324 100644
--- a/phpBB/includes/acp/acp_prune.php
+++ b/phpBB/includes/acp/acp_prune.php
@@ -436,8 +436,8 @@ class acp_prune
$sort_by_types = array('username', 'user_email', 'user_posts', 'user_regdate', 'user_lastvisit');
$where_sql = '';
- $where_sql .= ($username) ? ' AND username_clean ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($username))) : '';
- $where_sql .= ($email) ? ' AND user_email ' . $db->sql_like_expression(str_replace('*', $db->any_char, $email)) . ' ' : '';
+ $where_sql .= ($username) ? ' AND username_clean ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($username))) : '';
+ $where_sql .= ($email) ? ' AND user_email ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $email)) . ' ' : '';
$where_sql .= $joined_sql;
$where_sql .= ($count) ? " AND user_posts " . $key_match[$count_select] . ' ' . (int) $count . ' ' : '';
diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php
index 9cb5efdbe0..3d7ccf422c 100644
--- a/phpBB/includes/acp/acp_reasons.php
+++ b/phpBB/includes/acp/acp_reasons.php
@@ -219,7 +219,7 @@ class acp_reasons
$other_reason_id = (int) $db->sql_fetchfield('reason_id');
$db->sql_freeresult($result);
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
// The ugly one!
case 'mysqli':
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index d07120a65f..71880c2267 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -2384,7 +2384,7 @@ class acp_users
// Select auth options
$sql = 'SELECT auth_option, is_local, is_global
FROM ' . ACL_OPTIONS_TABLE . '
- WHERE auth_option ' . $db->sql_like_expression($db->any_char . '_') . '
+ WHERE auth_option ' . $db->sql_like_expression($db->get_any_char() . '_') . '
AND is_global = 1
ORDER BY auth_option';
$result = $db->sql_query($sql);
@@ -2404,7 +2404,7 @@ class acp_users
{
$sql = 'SELECT auth_option, is_local, is_global
FROM ' . ACL_OPTIONS_TABLE . "
- WHERE auth_option " . $db->sql_like_expression($db->any_char . '_') . "
+ WHERE auth_option " . $db->sql_like_expression($db->get_any_char() . '_') . "
AND is_local = 1
ORDER BY is_global DESC, auth_option";
$result = $db->sql_query($sql);
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index 7bb8e824d6..7ff3212b72 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -1024,7 +1024,7 @@ class auth_admin extends \phpbb\auth\auth
// Get permission type
$sql = 'SELECT auth_option, auth_option_id
FROM ' . ACL_OPTIONS_TABLE . "
- WHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char);
+ WHERE auth_option " . $db->sql_like_expression($permission_type . $db->get_any_char());
$result = $db->sql_query($sql);
$auth_id_ary = array();
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 48cd30e0a4..9d5770069d 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -4029,7 +4029,7 @@ function obtain_guest_count($item_id = 0, $item = 'forum')
// Get number of online guests
- if ($db->sql_layer === 'sqlite' || $db->sql_layer === 'sqlite3')
+ if ($db->get_sql_layer() === 'sqlite' || $db->get_sql_layer() === 'sqlite3')
{
$sql = 'SELECT COUNT(session_ip) as num_guests
FROM (
@@ -5096,7 +5096,7 @@ function phpbb_generate_debug_output(phpbb\db\driver\driver_interface $db, \phpb
if (isset($GLOBALS['starttime']))
{
$totaltime = microtime(true) - $GLOBALS['starttime'];
- $debug_info[] = sprintf('<abbr title="SQL time: %.3fs / PHP time: %.3fs">Time: %.3fs</abbr>', $db->sql_time, ($totaltime - $db->sql_time), $totaltime);
+ $debug_info[] = sprintf('<abbr title="SQL time: %.3fs / PHP time: %.3fs">Time: %.3fs</abbr>', $db->get_sql_time(), ($totaltime - $db->get_sql_time()), $totaltime);
}
$debug_info[] = sprintf('<abbr title="Cached: %d">Queries: %d</abbr>', $db->sql_num_queries(true), $db->sql_num_queries());
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 6bf8ce2c81..accc8a6a83 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -1435,7 +1435,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
{
case 'topic_moved':
$db->sql_transaction('begin');
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'mysql4':
case 'mysqli':
@@ -2441,7 +2441,7 @@ function phpbb_cache_moderators($db, $cache, $auth)
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
// Clear table
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'sqlite':
case 'sqlite3':
@@ -2491,7 +2491,7 @@ function phpbb_cache_moderators($db, $cache, $auth)
AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1)
AND ' . $db->sql_in_set('ug.user_id', $ug_id_ary) . "
AND ug.user_pending = 0
- AND o.auth_option " . $db->sql_like_expression('m_' . $db->any_char),
+ AND o.auth_option " . $db->sql_like_expression('m_' . $db->get_any_char()),
);
$sql = $db->sql_build_query('SELECT', $sql_ary_deny);
$result = $db->sql_query($sql);
@@ -2697,11 +2697,11 @@ function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false)
return;
}
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'mysqli':
case 'mysql4':
- $sql = 'DELETE ' . (($db->sql_layer === 'mysqli' || version_compare($db->sql_server_info(true), '4.1', '>=')) ? 'z.*' : ZEBRA_TABLE) . '
+ $sql = 'DELETE ' . (($db->get_sql_layer() === 'mysqli' || version_compare($db->sql_server_info(true), '4.1', '>=')) ? 'z.*' : ZEBRA_TABLE) . '
FROM ' . ZEBRA_TABLE . ' z, ' . USER_GROUP_TABLE . ' ug
WHERE z.zebra_id = ug.user_id
AND z.foe = 1
@@ -2854,7 +2854,7 @@ function get_database_size()
$database_size = false;
// This code is heavily influenced by a similar routine in phpMyAdmin 2.2.0
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'mysql':
case 'mysql4':
@@ -2870,7 +2870,7 @@ function get_database_size()
if (preg_match('#(3\.23|[45]\.)#', $version))
{
- $db_name = (preg_match('#^(?:3\.23\.(?:[6-9]|[1-9]{2}))|[45]\.#', $version)) ? "`{$db->dbname}`" : $db->dbname;
+ $db_name = (preg_match('#^(?:3\.23\.(?:[6-9]|[1-9]{2}))|[45]\.#', $version)) ? "`{$db->get_db_name()}`" : $db->get_db_name();
$sql = 'SHOW TABLE STATUS
FROM ' . $db_name;
@@ -2946,7 +2946,7 @@ function get_database_size()
if ($row['proname'] == 'pg_database_size')
{
- $database = $db->dbname;
+ $database = $db->get_db_name();
if (strpos($database, '.') !== false)
{
list($database, ) = explode('.', $database);
diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php
index 5794d2f403..a00613c26b 100644
--- a/phpBB/includes/functions_container.php
+++ b/phpBB/includes/functions_container.php
@@ -64,9 +64,10 @@ function phpbb_bootstrap_table_prefix($config_file)
*
* @param string $config_file
* @param string $phpbb_root_path
+* @param \phpbb\db\driver\driver_interface $db The generated connection
* @return array enabled extensions
*/
-function phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path)
+function phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path, &$db)
{
$db = phpbb_bootstrap_db_connection($config_file);
$table_prefix = phpbb_bootstrap_table_prefix($config_file);
@@ -133,7 +134,7 @@ function phpbb_create_install_container($phpbb_root_path, $php_ext)
$container->setParameter('core.php_ext', $php_ext);
$container->setParameter('core.table_prefix', '');
- $container->register('dbal.conn')->setSynthetic(true);
+ $container->register('dbal.conn.driver')->setSynthetic(true);
$container->setAlias('cache.driver', 'cache.driver.install');
@@ -259,9 +260,10 @@ function phpbb_create_dumped_container_unless_debug($config_file, array $extensi
function phpbb_create_default_container($phpbb_root_path, $php_ext)
{
$config_file = $phpbb_root_path . 'config.' . $php_ext;
- $installed_exts = phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path);
+ $db = null;
+ $installed_exts = phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path, $db);
- return phpbb_create_dumped_container_unless_debug(
+ $container = phpbb_create_dumped_container_unless_debug(
$config_file,
array(
new \phpbb\di\extension\config($config_file),
@@ -275,6 +277,10 @@ function phpbb_create_default_container($phpbb_root_path, $php_ext)
$phpbb_root_path,
$php_ext
);
+
+ $container->get('dbal.conn')->set_driver($db);
+
+ return $container;
}
/**
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 864a43c6e7..9d480692e9 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -1647,7 +1647,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting = ACL_NO)
switch ($sql_type)
{
case 'insert':
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'mysql':
case 'mysql4':
@@ -2041,7 +2041,7 @@ function update_topics_posted()
{
global $db, $config;
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'sqlite':
case 'sqlite3':
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
index b5d1573d12..06f49e4b50 100644
--- a/phpBB/includes/functions_install.php
+++ b/phpBB/includes/functions_install.php
@@ -290,7 +290,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
switch ($dbms_details['DRIVER'])
{
case 'phpbb\db\driver\mysqli':
- if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<'))
+ if (version_compare(mysqli_get_server_info($db->get_db_connect_id()), '4.1.3', '<'))
{
$error[] = $lang['INST_ERR_DB_NO_MYSQLI'];
}
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 8d926ec70a..da27d8900d 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -1350,7 +1350,7 @@ class parse_message extends bbcode_firstpass
// NOTE: obtain_* function? chaching the table contents?
// For now setting the ttl to 10 minutes
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'mssql':
case 'mssql_odbc':
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 84e9e8c462..01447a6232 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -92,7 +92,7 @@ function phpbb_insert_forums()
$src_db->sql_query("SET NAMES 'utf8'");
}
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'mssql':
case 'mssql_odbc':
@@ -289,7 +289,7 @@ function phpbb_insert_forums()
}
$src_db->sql_freeresult($result);
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'postgres':
$db->sql_query("SELECT SETVAL('" . FORUMS_TABLE . "_seq',(select case when max(forum_id)>0 then max(forum_id)+1 else 1 end from " . FORUMS_TABLE . '));');
@@ -1768,7 +1768,7 @@ function phpbb_create_userconv_table()
global $db, $src_db, $convert, $table_prefix, $user, $lang;
$map_dbms = '';
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'mysql':
$map_dbms = 'mysql_40';
@@ -1796,7 +1796,7 @@ function phpbb_create_userconv_table()
break;
default:
- $map_dbms = $db->sql_layer;
+ $map_dbms = $db->get_sql_layer();
break;
}
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index c349d71563..63e4e8f4ac 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -176,7 +176,7 @@ header('Content-type: text/html; charset=UTF-8');
<br />
- <p><?php echo $user->lang['DATABASE_TYPE']; ?> :: <strong><?php echo $db->sql_layer; ?></strong><br />
+ <p><?php echo $user->lang['DATABASE_TYPE']; ?> :: <strong><?php echo $db->get_sql_layer(); ?></strong><br />
<?php echo $user->lang['PREVIOUS_VERSION']; ?> :: <strong><?php echo $config['version']; ?></strong><br />
<?php
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index bff7b75b18..c8a745825a 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -688,7 +688,7 @@ class module
));
// Rollback if in transaction
- if ($db->transaction)
+ if ($db->get_transaction())
{
$db->sql_transaction('rollback');
}
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index a0d5e802e6..6109f5e28b 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -248,7 +248,7 @@ class install_convert extends module
));
}
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'sqlite':
case 'sqlite3':
@@ -727,7 +727,7 @@ class install_convert extends module
$src_db->sql_query("SET NAMES 'binary'");
}
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'sqlite':
case 'sqlite3':
@@ -1129,7 +1129,7 @@ class install_convert extends module
if (!empty($schema['autoincrement']))
{
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'postgres':
$db->sql_query("SELECT SETVAL('" . $schema['target'] . "_seq',(select case when max(" . $schema['autoincrement'] . ")>0 then max(" . $schema['autoincrement'] . ")+1 else 1 end from " . $schema['target'] . '));');
@@ -1268,7 +1268,7 @@ class install_convert extends module
if (!empty($schema['autoincrement']))
{
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'mssql':
case 'mssql_odbc':
@@ -1301,7 +1301,7 @@ class install_convert extends module
if ($sql_flag === true)
{
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
// If MySQL, we'll wait to have num_wait_rows rows to submit at once
case 'mysql':
@@ -1396,7 +1396,7 @@ class install_convert extends module
if (!empty($schema['autoincrement']))
{
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'mssql':
case 'mssql_odbc':
@@ -1635,7 +1635,7 @@ class install_convert extends module
'RESULT' => $user->lang['DONE'],
));
- if ($db->sql_error_triggered)
+ if ($db->get_sql_error_triggered())
{
$template->assign_vars(array(
'S_ERROR_BOX' => true,
@@ -1808,7 +1808,7 @@ class install_convert extends module
global $convert;
// Can we use IGNORE with this DBMS?
- $sql_ignore = (strpos($db->sql_layer, 'mysql') === 0 && !defined('DEBUG')) ? 'IGNORE ' : '';
+ $sql_ignore = (strpos($db->get_sql_layer(), 'mysql') === 0 && !defined('DEBUG')) ? 'IGNORE ' : '';
$insert_query = 'INSERT ' . $sql_ignore . 'INTO ' . $schema['target'] . ' (';
$aliases = array();
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index 5f8c0c277c..43fd6eaf07 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -1532,10 +1532,10 @@ class install_install extends module
$_module->update_module_data($module_data, true);
// Check for last sql error happened
- if ($db->sql_error_triggered)
+ if ($db->get_sql_error_triggered())
{
- $error = $db->sql_error($db->sql_error_sql);
- $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
+ $error = $db->sql_error($db->get_sql_error_sql());
+ $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__);
}
$categories[$cat_name]['id'] = (int) $module_data['module_id'];
@@ -1566,10 +1566,10 @@ class install_install extends module
$_module->update_module_data($module_data, true);
// Check for last sql error happened
- if ($db->sql_error_triggered)
+ if ($db->get_sql_error_triggered())
{
- $error = $db->sql_error($db->sql_error_sql);
- $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
+ $error = $db->sql_error($db->get_sql_error_sql());
+ $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__);
}
$categories[$level2_name]['id'] = (int) $module_data['module_id'];
@@ -1606,10 +1606,10 @@ class install_install extends module
$_module->update_module_data($module_data, true);
// Check for last sql error happened
- if ($db->sql_error_triggered)
+ if ($db->get_sql_error_triggered())
{
- $error = $db->sql_error($db->sql_error_sql);
- $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
+ $error = $db->sql_error($db->get_sql_error_sql());
+ $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__);
}
}
}
@@ -1772,10 +1772,10 @@ class install_install extends module
$_module->update_module_data($module_data, true);
// Check for last sql error happened
- if ($db->sql_error_triggered)
+ if ($db->get_sql_error_triggered())
{
- $error = $db->sql_error($db->sql_error_sql);
- $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
+ $error = $db->sql_error($db->get_sql_error_sql());
+ $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__);
}
}
}
@@ -1824,10 +1824,10 @@ class install_install extends module
$db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $lang_pack));
$installed_languages[] = (int) $db->sql_nextid();
- if ($db->sql_error_triggered)
+ if ($db->get_sql_error_triggered())
{
- $error = $db->sql_error($db->sql_error_sql);
- $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
+ $error = $db->sql_error($db->get_sql_error_sql());
+ $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__);
}
}
}
@@ -1913,7 +1913,7 @@ class install_install extends module
if (!$user_id)
{
// If we can't insert this user then continue to the next one to avoid inconsistent data
- $this->p_master->db_error('Unable to insert bot into users table', $db->sql_error_sql, __LINE__, __FILE__, true);
+ $this->p_master->db_error('Unable to insert bot into users table', $db->get_sql_error_sql(), __LINE__, __FILE__, true);
continue;
}
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 63541dbee6..02051bf0df 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -799,7 +799,7 @@ switch ($mode)
$sql = 'SELECT username, user_id, user_colour
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_type', array(USER_NORMAL, USER_FOUNDER)) . '
- AND username_clean ' . $db->sql_like_expression(utf8_clean_string($username_chars) . $db->any_char);
+ AND username_clean ' . $db->sql_like_expression(utf8_clean_string($username_chars) . $db->get_any_char());
$result = $db->sql_query_limit($sql, 10);
$user_list = array();
@@ -920,9 +920,9 @@ switch ($mode)
$s_find_active_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
}
- $sql_where .= ($username) ? ' AND u.username_clean ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($username))) : '';
- $sql_where .= ($auth->acl_get('a_user') && $email) ? ' AND u.user_email ' . $db->sql_like_expression(str_replace('*', $db->any_char, $email)) . ' ' : '';
- $sql_where .= ($jabber) ? ' AND u.user_jabber ' . $db->sql_like_expression(str_replace('*', $db->any_char, $jabber)) . ' ' : '';
+ $sql_where .= ($username) ? ' AND u.username_clean ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($username))) : '';
+ $sql_where .= ($auth->acl_get('a_user') && $email) ? ' AND u.user_email ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $email)) . ' ' : '';
+ $sql_where .= ($jabber) ? ' AND u.user_jabber ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $jabber)) . ' ' : '';
$sql_where .= (is_numeric($count) && isset($find_key_match[$count_select])) ? ' AND u.user_posts ' . $find_key_match[$count_select] . ' ' . (int) $count . ' ' : '';
if (isset($find_key_match[$joined_select]) && sizeof($joined) == 3)
@@ -1016,12 +1016,12 @@ switch ($mode)
{
for ($i = 97; $i < 123; $i++)
{
- $sql_where .= ' AND u.username_clean NOT ' . $db->sql_like_expression(chr($i) . $db->any_char);
+ $sql_where .= ' AND u.username_clean NOT ' . $db->sql_like_expression(chr($i) . $db->get_any_char());
}
}
else if ($first_char)
{
- $sql_where .= ' AND u.username_clean ' . $db->sql_like_expression(substr($first_char, 0, 1) . $db->any_char);
+ $sql_where .= ' AND u.username_clean ' . $db->sql_like_expression(substr($first_char, 0, 1) . $db->get_any_char());
}
// Are we looking at a usergroup? If so, fetch additional info
diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php
index 20c60364d8..65249275d4 100644
--- a/phpBB/phpbb/auth/auth.php
+++ b/phpBB/phpbb/auth/auth.php
@@ -1043,7 +1043,7 @@ class auth
{
if (strpos($auth_options, '%') !== false)
{
- $sql_opts = "AND $key " . $db->sql_like_expression(str_replace('%', $db->any_char, $auth_options));
+ $sql_opts = "AND $key " . $db->sql_like_expression(str_replace('%', $db->get_any_char(), $auth_options));
}
else
{
@@ -1074,7 +1074,7 @@ class auth
{
if (strpos($option, '%') !== false)
{
- $sql[] = $key . ' ' . $db->sql_like_expression(str_replace('%', $db->any_char, $option));
+ $sql[] = $key . ' ' . $db->sql_like_expression(str_replace('%', $db->get_any_char(), $option));
}
else
{
diff --git a/phpBB/phpbb/cache/service.php b/phpBB/phpbb/cache/service.php
index e47177758a..d6bf150384 100644
--- a/phpBB/phpbb/cache/service.php
+++ b/phpBB/phpbb/cache/service.php
@@ -305,7 +305,7 @@ class service
{
if (($bots = $this->driver->get('_bots')) === false)
{
- switch ($this->db->sql_layer)
+ switch ($this->db->get_sql_layer())
{
case 'mssql':
case 'mssql_odbc':
diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php
index 3d4aa95606..3e9110d8bc 100644
--- a/phpBB/phpbb/db/driver/driver.php
+++ b/phpBB/phpbb/db/driver/driver.php
@@ -87,6 +87,102 @@ abstract class driver implements driver_interface
}
/**
+ * {@inheritdoc}
+ */
+ public function get_sql_layer()
+ {
+ return $this->sql_layer;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_db_name()
+ {
+ return $this->dbname;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_any_char()
+ {
+ return $this->any_char;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_one_char()
+ {
+ return $this->one_char;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_db_connect_id()
+ {
+ return $this->db_connect_id;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_sql_error_triggered()
+ {
+ return $this->sql_error_triggered;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_sql_error_sql()
+ {
+ return $this->sql_error_sql;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_transaction()
+ {
+ return $this->transaction;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_sql_time()
+ {
+ return $this->sql_time;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_sql_error_returned()
+ {
+ return $this->sql_error_returned;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_multi_insert()
+ {
+ return $this->multi_insert;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function set_multi_insert($multi_insert)
+ {
+ $this->multi_insert = $multi_insert;
+ }
+
+ /**
* {@inheritDoc}
*/
function sql_return_on_error($fail = false)
diff --git a/phpBB/phpbb/db/driver/driver_interface.php b/phpBB/phpbb/db/driver/driver_interface.php
index 7f7d341e2d..6722d059a5 100644
--- a/phpBB/phpbb/db/driver/driver_interface.php
+++ b/phpBB/phpbb/db/driver/driver_interface.php
@@ -16,6 +16,90 @@ namespace phpbb\db\driver;
interface driver_interface
{
/**
+ * Gets the name of the sql layer.
+ *
+ * @return string
+ */
+ public function get_sql_layer();
+
+ /**
+ * Gets the name of the database.
+ *
+ * @return string
+ */
+ public function get_db_name();
+
+ /**
+ * Wildcards for matching any (%) character within LIKE expressions
+ *
+ * @return string
+ */
+ public function get_any_char();
+
+ /**
+ * Wildcards for matching exactly one (_) character within LIKE expressions
+ *
+ * @return string
+ */
+ public function get_one_char();
+
+ /**
+ * Gets the time spent into the queries
+ *
+ * @return int
+ */
+ public function get_sql_time();
+
+ /**
+ * Gets the connect ID.
+ *
+ * @return mixed
+ */
+ public function get_db_connect_id();
+
+ /**
+ * Indicates if an error was triggered.
+ *
+ * @return bool
+ */
+ public function get_sql_error_triggered();
+
+ /**
+ * Gets the last faulty query
+ *
+ * @return string
+ */
+ public function get_sql_error_sql();
+
+ /**
+ * Indicates if we are in a transaction.
+ *
+ * @return bool
+ */
+ public function get_transaction();
+
+ /**
+ * Gets the returned error.
+ *
+ * @return array
+ */
+ public function get_sql_error_returned();
+
+ /**
+ * Indicates if multiple insertion can be used
+ *
+ * @return bool
+ */
+ public function get_multi_insert();
+
+ /**
+ * Set if multiple insertion can be used
+ *
+ * @param bool $multi_insert
+ */
+ public function set_multi_insert($multi_insert);
+
+ /**
* Gets the exact number of rows in a specified table.
*
* @param string $table_name Table name
diff --git a/phpBB/phpbb/db/driver/factory.php b/phpBB/phpbb/db/driver/factory.php
new file mode 100644
index 0000000000..f0fa18051b
--- /dev/null
+++ b/phpBB/phpbb/db/driver/factory.php
@@ -0,0 +1,435 @@
+<?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;
+
+use \Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+* Database Abstraction Layer
+*/
+class factory implements driver_interface
+{
+ /**
+ * @var driver_interface
+ */
+ protected $driver = null;
+
+ /**
+ * @var ContainerInterface
+ */
+ protected $container;
+
+ /**
+ * Constructor.
+ *
+ * @param ContainerInterface $container A ContainerInterface instance
+ */
+ public function __construct(ContainerInterface $container)
+ {
+ $this->container = $container;
+ }
+
+ /**
+ * Return the current driver (and retrieved it from the container if necessary)
+ *
+ * @return driver_interface
+ */
+ protected function get_driver()
+ {
+ if ($this->driver === null)
+ {
+ $this->driver = $this->container->get('dbal.conn.driver');
+ }
+
+ return $this->driver;
+ }
+
+ /**
+ * Set the current driver
+ *
+ * @param driver_interface $driver
+ */
+ public function set_driver(driver_interface $driver)
+ {
+ $this->driver = $driver;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_sql_layer()
+ {
+ return $this->get_driver()->get_sql_layer();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_db_name()
+ {
+ return $this->get_driver()->get_db_name();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_any_char()
+ {
+ return $this->get_driver()->get_any_char();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_one_char()
+ {
+ return $this->get_driver()->get_one_char();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_db_connect_id()
+ {
+ return $this->get_driver()->get_db_connect_id();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_sql_error_triggered()
+ {
+ return $this->get_driver()->get_sql_error_triggered();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_sql_error_sql()
+ {
+ return $this->get_driver()->get_sql_error_sql();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_transaction()
+ {
+ return $this->get_driver()->get_transaction();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_sql_time()
+ {
+ return $this->get_driver()->get_sql_time();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_sql_error_returned()
+ {
+ return $this->get_driver()->get_sql_error_returned();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_multi_insert()
+ {
+ return $this->get_driver()->get_multi_insert();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function set_multi_insert($multi_insert)
+ {
+ $this->get_driver()->set_multi_insert($multi_insert);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_row_count($table_name)
+ {
+ return $this->get_driver()->get_row_count($table_name);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_estimated_row_count($table_name)
+ {
+ return $this->get_driver()->get_estimated_row_count($table_name);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_lower_text($column_name)
+ {
+ return $this->get_driver()->sql_lower_text($column_name);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_error($sql = '')
+ {
+ return $this->get_driver()->sql_error($sql);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_buffer_nested_transactions()
+ {
+ return $this->get_driver()->sql_buffer_nested_transactions();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_bit_or($column_name, $bit, $compare = '')
+ {
+ return $this->get_driver()->sql_bit_or($column_name, $bit, $compare);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_server_info($raw = false, $use_cache = true)
+ {
+ return $this->get_driver()->sql_server_info($raw, $use_cache);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_return_on_error($fail = false)
+ {
+ return $this->get_driver()->sql_return_on_error($fail);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_build_array($query, $assoc_ary = array())
+ {
+ return $this->get_driver()->sql_build_array($query, $assoc_ary);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_fetchrowset($query_id = false)
+ {
+ return $this->get_driver()->sql_fetchrowset($query_id);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_transaction($status = 'begin')
+ {
+ return $this->get_driver()->sql_transaction($status);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_concatenate($expr1, $expr2)
+ {
+ return $this->get_driver()->sql_concatenate($expr1, $expr2);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_case($condition, $action_true, $action_false = false)
+ {
+ return $this->get_driver()->sql_case($condition, $action_true, $action_false);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_build_query($query, $array)
+ {
+ return $this->get_driver()->sql_build_query($query, $array);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_fetchfield($field, $rownum = false, $query_id = false)
+ {
+ return $this->get_driver()->sql_fetchfield($field, $rownum, $query_id);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_fetchrow($query_id = false)
+ {
+ return $this->get_driver()->sql_fetchrow($query_id);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function cast_expr_to_bigint($expression)
+ {
+ return $this->get_driver()->cast_expr_to_bigint($expression);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_nextid()
+ {
+ return $this->get_driver()->sql_nextid();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_add_num_queries($cached = false)
+ {
+ return $this->get_driver()->sql_add_num_queries($cached);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
+ {
+ return $this->get_driver()->sql_query_limit($query, $total, $offset, $cache_ttl);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_query($query = '', $cache_ttl = 0)
+ {
+ return $this->get_driver()->sql_query($query, $cache_ttl);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function cast_expr_to_string($expression)
+ {
+ return $this->get_driver()->cast_expr_to_string($expression);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
+ {
+ throw new \Exception('Disabled method.');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_bit_and($column_name, $bit, $compare = '')
+ {
+ return $this->get_driver()->sql_bit_and($column_name, $bit, $compare);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_freeresult($query_id = false)
+ {
+ return $this->get_driver()->sql_freeresult($query_id);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_num_queries($cached = false)
+ {
+ return $this->get_driver()->sql_num_queries($cached);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_multi_insert($table, $sql_ary)
+ {
+ return $this->get_driver()->sql_multi_insert($table, $sql_ary);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_affectedrows()
+ {
+ return $this->get_driver()->sql_affectedrows();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_close()
+ {
+ return $this->get_driver()->sql_close();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_rowseek($rownum, &$query_id)
+ {
+ return $this->get_driver()->sql_rowseek($rownum, $query_id);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_escape($msg)
+ {
+ return $this->get_driver()->sql_escape($msg);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_like_expression($expression)
+ {
+ return $this->get_driver()->sql_like_expression($expression);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_report($mode, $query = '')
+ {
+ return $this->get_driver()->sql_report($mode, $query);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function sql_in_set($field, $array, $negate = false, $allow_empty_set = false)
+ {
+ return $this->get_driver()->sql_in_set($field, $array, $negate, $allow_empty_set);
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php b/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php
index edcc69e1bf..648ae9ce96 100644
--- a/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php
+++ b/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php
@@ -37,7 +37,7 @@ class local_url_bbcode extends \phpbb\db\migration\migration
{
$sql = 'SELECT *
FROM ' . BBCODES_TABLE . '
- WHERE bbcode_match ' . $this->db->sql_like_expression($this->db->any_char . 'LOCAL_URL' . $this->db->any_char);
+ WHERE bbcode_match ' . $this->db->sql_like_expression($this->db->get_any_char() . 'LOCAL_URL' . $this->db->get_any_char());
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php
index db3c587f82..9b08da0125 100644
--- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php
@@ -36,7 +36,7 @@ class release_3_0_4 extends \phpbb\db\migration\migration
public function rename_log_delete_topic()
{
- if ($this->db->sql_layer == 'oracle')
+ if ($this->db->get_sql_layer() == 'oracle')
{
// log_operation is CLOB - but we can change this later
$sql = 'UPDATE ' . $this->table_prefix . "log
diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php
index d86c4d6986..1843c3f262 100644
--- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php
@@ -76,7 +76,7 @@ class release_3_0_7_rc1 extends \phpbb\db\migration\migration
{
// Delete all text-templates from the template_data
$sql = 'DELETE FROM ' . STYLES_TEMPLATE_DATA_TABLE . '
- WHERE template_filename ' . $this->db->sql_like_expression($this->db->any_char . '.txt');
+ WHERE template_filename ' . $this->db->sql_like_expression($this->db->get_any_char() . '.txt');
$this->sql_query($sql);
}
}
diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php
index 24340c8cf1..06e46d522f 100644
--- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php
@@ -89,7 +89,7 @@ class release_3_0_9_rc1 extends \phpbb\db\migration\migration
// Update file extension group names to use language strings, again.
$sql = 'SELECT group_id, group_name
FROM ' . EXTENSION_GROUPS_TABLE . '
- WHERE group_name ' . $this->db->sql_like_expression('EXT_GROUP_' . $this->db->any_char);
+ WHERE group_name ' . $this->db->sql_like_expression('EXT_GROUP_' . $this->db->get_any_char());
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
diff --git a/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php b/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php
index df1560f5b1..4530ebe285 100644
--- a/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php
+++ b/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php
@@ -18,7 +18,7 @@ class mysql_fulltext_drop extends \phpbb\db\migration\migration
public function effectively_installed()
{
// This migration is irrelevant for all non-MySQL DBMSes.
- return strpos($this->db->sql_layer, 'mysql') === false;
+ return strpos($this->db->get_sql_layer(), 'mysql') === false;
}
static public function depends_on()
diff --git a/phpBB/phpbb/db/migration/data/v310/postgres_fulltext_drop.php b/phpBB/phpbb/db/migration/data/v310/postgres_fulltext_drop.php
index ca784656e7..ea442dfb1b 100644
--- a/phpBB/phpbb/db/migration/data/v310/postgres_fulltext_drop.php
+++ b/phpBB/phpbb/db/migration/data/v310/postgres_fulltext_drop.php
@@ -18,7 +18,7 @@ class postgres_fulltext_drop extends \phpbb\db\migration\migration
public function effectively_installed()
{
// This migration is irrelevant for all non-PostgreSQL DBMSes.
- return strpos($this->db->sql_layer, 'postgres') === false;
+ return strpos($this->db->get_sql_layer(), 'postgres') === false;
}
static public function depends_on()
diff --git a/phpBB/phpbb/db/migration/migration.php b/phpBB/phpbb/db/migration/migration.php
index fdfc31da3a..5f120333e1 100644
--- a/phpBB/phpbb/db/migration/migration.php
+++ b/phpBB/phpbb/db/migration/migration.php
@@ -160,11 +160,11 @@ abstract class migration
else
{
$result = $this->db->sql_query($sql);
- if ($this->db->sql_error_triggered)
+ if ($this->db->get_sql_error_triggered())
{
$this->errors[] = array(
- 'sql' => $this->db->sql_error_sql,
- 'code' => $this->db->sql_error_returned,
+ 'sql' => $this->db->get_sql_error_sql(),
+ 'code' => $this->db->get_sql_error_returned(),
);
}
}
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index c2f7b5ab23..8b089a060f 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -110,7 +110,7 @@ class migrator
FROM " . $this->migrations_table;
$result = $this->db->sql_query($sql);
- if (!$this->db->sql_error_triggered)
+ if (!$this->db->get_sql_error_triggered())
{
while ($migration = $this->db->sql_fetchrow($result))
{
diff --git a/phpBB/phpbb/db/sql_insert_buffer.php b/phpBB/phpbb/db/sql_insert_buffer.php
index 6b6f556571..14e3c54f09 100644
--- a/phpBB/phpbb/db/sql_insert_buffer.php
+++ b/phpBB/phpbb/db/sql_insert_buffer.php
@@ -92,7 +92,7 @@ class sql_insert_buffer
// Flush buffer if it is full or when DB does not support multi inserts.
// In the later case, the buffer will always only contain one row.
- if (!$this->db->multi_insert || sizeof($this->buffer) >= $this->max_buffered_rows)
+ if (!$this->db->get_multi_insert() || sizeof($this->buffer) >= $this->max_buffered_rows)
{
return $this->flush();
}
diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php
index 2ec46ed239..18defc4535 100644
--- a/phpBB/phpbb/db/tools.php
+++ b/phpBB/phpbb/db/tools.php
@@ -323,7 +323,7 @@ class tools
$this->dbms_type_map = self::get_dbms_type_map();
// Determine mapping database type
- switch ($this->db->sql_layer)
+ switch ($this->db->get_sql_layer())
{
case 'mysql':
$this->sql_layer = 'mysql_40';
@@ -354,7 +354,7 @@ class tools
break;
default:
- $this->sql_layer = $this->db->sql_layer;
+ $this->sql_layer = $this->db->get_sql_layer();
break;
}
}
@@ -377,7 +377,7 @@ class tools
*/
function sql_list_tables()
{
- switch ($this->db->sql_layer)
+ switch ($this->db->get_sql_layer())
{
case 'mysql':
case 'mysql4':
@@ -711,7 +711,7 @@ class tools
$sqlite = false;
// For SQLite we need to perform the schema changes in a much more different way
- if (($this->db->sql_layer == 'sqlite' || $this->db->sql_layer == 'sqlite3') && $this->return_statements)
+ if (($this->db->get_sql_layer() == 'sqlite' || $this->db->get_sql_layer() == 'sqlite3') && $this->return_statements)
{
$sqlite_data = array();
$sqlite = true;
diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php
index bf0bfe0ae1..4ffe7345f3 100644
--- a/phpBB/phpbb/log/log.php
+++ b/phpBB/phpbb/log/log.php
@@ -737,7 +737,7 @@ class log implements \phpbb\log\log_interface
for ($i = 0, $num_keywords = sizeof($keywords); $i < $num_keywords; $i++)
{
$keywords_pattern[] = preg_quote($keywords[$i], '#');
- $keywords[$i] = $this->db->sql_like_expression($this->db->any_char . $keywords[$i] . $this->db->any_char);
+ $keywords[$i] = $this->db->sql_like_expression($this->db->get_any_char() . $keywords[$i] . $this->db->get_any_char());
}
$keywords_pattern = '#' . implode('|', $keywords_pattern) . '#ui';
diff --git a/phpBB/phpbb/search/base.php b/phpBB/phpbb/search/base.php
index 861b1f9328..9395b6a273 100644
--- a/phpBB/phpbb/search/base.php
+++ b/phpBB/phpbb/search/base.php
@@ -282,7 +282,7 @@ class base
$sql_where = '';
foreach ($words as $word)
{
- $sql_where .= " OR search_keywords " . $db->sql_like_expression($db->any_char . $word . $db->any_char);
+ $sql_where .= " OR search_keywords " . $db->sql_like_expression($db->get_any_char() . $word . $db->get_any_char());
}
$sql = 'SELECT search_key
@@ -303,7 +303,7 @@ class base
$sql_where = '';
foreach ($authors as $author)
{
- $sql_where .= (($sql_where) ? ' OR ' : '') . 'search_authors ' . $db->sql_like_expression($db->any_char . ' ' . (int) $author . ' ' . $db->any_char);
+ $sql_where .= (($sql_where) ? ' OR ' : '') . 'search_authors ' . $db->sql_like_expression($db->get_any_char() . ' ' . (int) $author . ' ' . $db->get_any_char());
}
$sql = 'SELECT search_key
diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php
index 3e8e492cd8..d4e7de31e5 100644
--- a/phpBB/phpbb/search/fulltext_mysql.php
+++ b/phpBB/phpbb/search/fulltext_mysql.php
@@ -140,7 +140,7 @@ class fulltext_mysql extends \phpbb\search\base
*/
public function init()
{
- if ($this->db->sql_layer != 'mysql4' && $this->db->sql_layer != 'mysqli')
+ if ($this->db->get_sql_layer() != 'mysql4' && $this->db->get_sql_layer() != 'mysqli')
{
return $this->user->lang['FULLTEXT_MYSQL_INCOMPATIBLE_DATABASE'];
}
@@ -764,7 +764,7 @@ class fulltext_mysql extends \phpbb\search\base
if (!isset($this->stats['post_subject']))
{
- if ($this->db->sql_layer == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
+ if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
{
$alter[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL';
}
@@ -777,7 +777,7 @@ class fulltext_mysql extends \phpbb\search\base
if (!isset($this->stats['post_content']))
{
- if ($this->db->sql_layer == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
+ if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
{
$alter[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL';
}
@@ -872,7 +872,7 @@ class fulltext_mysql extends \phpbb\search\base
*/
protected function get_stats()
{
- if (strpos($this->db->sql_layer, 'mysql') === false)
+ if (strpos($this->db->get_sql_layer(), 'mysql') === false)
{
$this->stats = array();
return;
diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php
index 2fbff57990..48b0f077c7 100644
--- a/phpBB/phpbb/search/fulltext_native.php
+++ b/phpBB/phpbb/search/fulltext_native.php
@@ -758,7 +758,7 @@ class fulltext_native extends \phpbb\search\base
);
}
- switch ($this->db->sql_layer)
+ switch ($this->db->get_sql_layer())
{
case 'mysql4':
case 'mysqli':
@@ -978,7 +978,7 @@ class fulltext_native extends \phpbb\search\base
// If the cache was completely empty count the results
if (!$total_results)
{
- switch ($this->db->sql_layer)
+ switch ($this->db->get_sql_layer())
{
case 'mysql4':
case 'mysqli':
@@ -1000,7 +1000,7 @@ class fulltext_native extends \phpbb\search\base
}
else
{
- if ($this->db->sql_layer == 'sqlite' || $this->db->sql_layer == 'sqlite3')
+ if ($this->db->get_sql_layer() == 'sqlite' || $this->db->get_sql_layer() == 'sqlite3')
{
$sql = 'SELECT COUNT(topic_id) as total_results
FROM (SELECT DISTINCT t.topic_id';
@@ -1017,7 +1017,7 @@ class fulltext_native extends \phpbb\search\base
$post_visibility
$sql_fora
AND t.topic_id = p.topic_id
- $sql_time" . (($this->db->sql_layer == 'sqlite' || $this->db->sql_layer == 'sqlite3') ? ')' : '');
+ $sql_time" . (($this->db->get_sql_layer() == 'sqlite' || $this->db->get_sql_layer() == 'sqlite3') ? ')' : '');
}
$result = $this->db->sql_query($sql);
@@ -1481,7 +1481,7 @@ class fulltext_native extends \phpbb\search\base
*/
public function delete_index($acp_module, $u_action)
{
- switch ($this->db->sql_layer)
+ switch ($this->db->get_sql_layer())
{
case 'sqlite':
case 'sqlite3':
diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php
index bdb5a86009..02e0870fd2 100644
--- a/phpBB/phpbb/search/fulltext_postgres.php
+++ b/phpBB/phpbb/search/fulltext_postgres.php
@@ -107,7 +107,7 @@ class fulltext_postgres extends \phpbb\search\base
$this->word_length = array('min' => $this->config['fulltext_postgres_min_word_len'], 'max' => $this->config['fulltext_postgres_max_word_len']);
- if ($this->db->sql_layer == 'postgres')
+ if ($this->db->get_sql_layer() == 'postgres')
{
$pgsql_version = explode(',', substr($this->db->sql_server_info(), 10));
$this->version = trim($pgsql_version[0]);
@@ -185,7 +185,7 @@ class fulltext_postgres extends \phpbb\search\base
*/
public function init()
{
- if ($this->db->sql_layer != 'postgres')
+ if ($this->db->get_sql_layer() != 'postgres')
{
return $this->user->lang['FULLTEXT_POSTGRES_INCOMPATIBLE_DATABASE'];
}
@@ -869,7 +869,7 @@ class fulltext_postgres extends \phpbb\search\base
*/
protected function get_stats()
{
- if ($this->db->sql_layer != 'postgres')
+ if ($this->db->get_sql_layer() != 'postgres')
{
$this->stats = array();
return;
@@ -919,7 +919,7 @@ class fulltext_postgres extends \phpbb\search\base
<dt><label>' . $this->user->lang['FULLTEXT_POSTGRES_TS_NAME'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_POSTGRES_TS_NAME_EXPLAIN'] . '</span></dt>
<dd><select name="config[fulltext_postgres_ts_name]">';
- if ($this->db->sql_layer == 'postgres' && $this->tsearch_usable)
+ if ($this->db->get_sql_layer() == 'postgres' && $this->tsearch_usable)
{
$sql = 'SELECT cfgname AS ts_name
FROM pg_ts_config';
diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php
index 9008af338b..78c11f1180 100644
--- a/phpBB/phpbb/search/fulltext_sphinx.php
+++ b/phpBB/phpbb/search/fulltext_sphinx.php
@@ -199,7 +199,7 @@ class fulltext_sphinx
*/
public function init()
{
- if ($this->db->sql_layer != 'mysql' && $this->db->sql_layer != 'mysql4' && $this->db->sql_layer != 'mysqli' && $this->db->sql_layer != 'postgres')
+ if ($this->db->get_sql_layer() != 'mysql' && $this->db->get_sql_layer() != 'mysql4' && $this->db->get_sql_layer() != 'mysqli' && $this->db->get_sql_layer() != 'postgres')
{
return $this->user->lang['FULLTEXT_SPHINX_WRONG_DATABASE'];
}
@@ -218,11 +218,11 @@ class fulltext_sphinx
protected function config_generate()
{
// Check if Database is supported by Sphinx
- if ($this->db->sql_layer =='mysql' || $this->db->sql_layer == 'mysql4' || $this->db->sql_layer == 'mysqli')
+ if ($this->db->get_sql_layer() =='mysql' || $this->db->get_sql_layer() == 'mysql4' || $this->db->get_sql_layer() == 'mysqli')
{
$this->dbtype = 'mysql';
}
- else if ($this->db->sql_layer == 'postgres')
+ else if ($this->db->get_sql_layer() == 'postgres')
{
$this->dbtype = 'pgsql';
}
diff --git a/phpBB/search.php b/phpBB/search.php
index c01fcfede7..071db30f3d 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -145,7 +145,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
trigger_error($user->lang('TOO_FEW_AUTHOR_CHARS', (int) $config['min_search_author_chars']));
}
- $sql_where = (strpos($author, '*') !== false) ? ' username_clean ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($author))) : " username_clean = '" . $db->sql_escape(utf8_clean_string($author)) . "'";
+ $sql_where = (strpos($author, '*') !== false) ? ' username_clean ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($author))) : " username_clean = '" . $db->sql_escape(utf8_clean_string($author)) . "'";
$sql = 'SELECT user_id
FROM ' . USERS_TABLE . "
@@ -159,7 +159,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
}
$db->sql_freeresult($result);
- $sql_where = (strpos($author, '*') !== false) ? ' post_username ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($author))) : " post_username = '" . $db->sql_escape(utf8_clean_string($author)) . "'";
+ $sql_where = (strpos($author, '*') !== false) ? ' post_username ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($author))) : " post_username = '" . $db->sql_escape(utf8_clean_string($author)) . "'";
$sql = 'SELECT 1 as guest_post
FROM ' . POSTS_TABLE . "
@@ -172,7 +172,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
if ($found_guest_post)
{
$author_id_ary[] = ANONYMOUS;
- $sql_author_match = (strpos($author, '*') !== false) ? ' ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($author))) : " = '" . $db->sql_escape(utf8_clean_string($author)) . "'";
+ $sql_author_match = (strpos($author, '*') !== false) ? ' ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($author))) : " = '" . $db->sql_escape(utf8_clean_string($author)) . "'";
}
if (!sizeof($author_id_ary))
@@ -1296,7 +1296,7 @@ $template->assign_vars(array(
if ($auth->acl_get('a_search'))
{
// Handle large objects differently for Oracle and MSSQL
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'oracle':
$sql = 'SELECT search_time, search_keywords
diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php
index 82f990c2a2..4c897c58aa 100644
--- a/phpBB/viewonline.php
+++ b/phpBB/viewonline.php
@@ -103,7 +103,7 @@ $guest_counter = 0;
// Get number of online guests (if we do not display them)
if (!$show_guests)
{
- switch ($db->sql_layer)
+ switch ($db->get_sql_layer())
{
case 'sqlite':
case 'sqlite3':
diff --git a/tests/dbal/order_lower_test.php b/tests/dbal/order_lower_test.php
index b7a69c7c5d..b101d28c7d 100644
--- a/tests/dbal/order_lower_test.php
+++ b/tests/dbal/order_lower_test.php
@@ -22,7 +22,7 @@ class phpbb_dbal_order_lower_test extends phpbb_database_test_case
{
$db = $this->new_dbal();
- if (strpos($db->sql_layer, 'mysql') === 0 && version_compare($db->sql_server_info(true, false), '5.6', '>='))
+ if (strpos($db->get_sql_layer(), 'mysql') === 0 && version_compare($db->sql_server_info(true, false), '5.6', '>='))
{
$this->markTestSkipped('MySQL 5.6 fails to order things correctly. See also: http://tracker.phpbb.com/browse/PHPBB3-11571 http://bugs.mysql.com/bug.php?id=69005');
}
diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php
index 7cac4d6a3b..e480716a49 100644
--- a/tests/dbal/select_test.php
+++ b/tests/dbal/select_test.php
@@ -219,8 +219,8 @@ class phpbb_dbal_select_test extends phpbb_database_test_case
{
$db = $this->new_dbal();
- $like_expression = str_replace('*', $db->any_char, $like_expression);
- $like_expression = str_replace('#', $db->one_char, $like_expression);
+ $like_expression = str_replace('*', $db->get_any_char(), $like_expression);
+ $like_expression = str_replace('#', $db->get_one_char(), $like_expression);
$where = ($like_expression) ? 'username_clean ' . $db->sql_like_expression($like_expression) : '';
$result = $db->sql_query('SELECT username_clean
diff --git a/tests/dbal/sql_insert_buffer_test.php b/tests/dbal/sql_insert_buffer_test.php
index 2f9ed0008f..eae0abceba 100644
--- a/tests/dbal/sql_insert_buffer_test.php
+++ b/tests/dbal/sql_insert_buffer_test.php
@@ -32,7 +32,7 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case
public function test_multi_insert_disabled_insert_and_flush()
{
- $this->db->multi_insert = false;
+ $this->db->set_multi_insert(false);
$this->assertTrue($this->buffer->insert($this->get_row(1)));
$this->assert_config_count(3);
$this->assertFalse($this->buffer->flush());
@@ -50,7 +50,7 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case
public function test_multi_insert_disabled_insert_with_flush()
{
- $this->db->multi_insert = false;
+ $this->db->set_multi_insert(false);
$this->assertTrue($this->buffer->insert($this->get_row(1)));
$this->assert_config_count(3);
$this->assertTrue($this->buffer->insert($this->get_row(2)));
@@ -68,7 +68,7 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case
public function test_multi_insert_disabled_insert_all_and_flush()
{
- $this->db->multi_insert = false;
+ $this->db->set_multi_insert(false);
$this->assertTrue($this->buffer->insert_all($this->get_rows(3)));
$this->assert_config_count(5);
}
@@ -93,7 +93,7 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case
protected function check_multi_insert_support()
{
- if (!$this->db->multi_insert)
+ if (!$this->db->get_multi_insert())
{
$this->markTestSkipped('Database does not support multi_insert');
}