aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-10-14 14:56:46 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-10-14 14:56:46 +0000
commit4afaca12dc55b076293e9ef8ac28332d22730df0 (patch)
tree944b15618d8a0bed05fafb942e27322a739b2d3d /phpBB/includes
parent46922674ea1b5ecf96d14c0edfdbcf6af3743051 (diff)
downloadforums-4afaca12dc55b076293e9ef8ac28332d22730df0.tar
forums-4afaca12dc55b076293e9ef8ac28332d22730df0.tar.gz
forums-4afaca12dc55b076293e9ef8ac28332d22730df0.tar.bz2
forums-4afaca12dc55b076293e9ef8ac28332d22730df0.tar.xz
forums-4afaca12dc55b076293e9ef8ac28332d22730df0.zip
- store sql_layer directly within the layer itself
- new method sql_multi_insert to circumvent db-specific hacks (hopefully not introduced any parsing errors) git-svn-id: file:///svn/phpbb/trunk@6497 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_database.php39
-rw-r--r--phpBB/includes/acp/acp_forums.php32
-rw-r--r--phpBB/includes/acp/acp_groups.php19
-rw-r--r--phpBB/includes/acp/acp_icons.php2
-rw-r--r--phpBB/includes/acp/acp_main.php21
-rw-r--r--phpBB/includes/acp/acp_profile.php4
-rw-r--r--phpBB/includes/acp/acp_reasons.php2
-rw-r--r--phpBB/includes/acp/acp_users.php6
-rw-r--r--phpBB/includes/acp/auth.php57
-rw-r--r--phpBB/includes/auth.php4
-rw-r--r--phpBB/includes/cache.php2
-rw-r--r--phpBB/includes/db/dbal.php66
-rw-r--r--phpBB/includes/db/firebird.php13
-rw-r--r--phpBB/includes/db/mssql.php13
-rw-r--r--phpBB/includes/db/mssql_odbc.php13
-rw-r--r--phpBB/includes/db/mysql.php20
-rw-r--r--phpBB/includes/db/mysqli.php12
-rw-r--r--phpBB/includes/db/oracle.php14
-rw-r--r--phpBB/includes/db/postgres.php13
-rw-r--r--phpBB/includes/db/sqlite.php13
-rw-r--r--phpBB/includes/functions.php21
-rw-r--r--phpBB/includes/functions_admin.php50
-rw-r--r--phpBB/includes/functions_posting.php19
-rw-r--r--phpBB/includes/functions_privmsgs.php19
-rw-r--r--phpBB/includes/functions_user.php54
-rw-r--r--phpBB/includes/message_parser.php2
-rw-r--r--phpBB/includes/search/fulltext_mysql.php4
-rwxr-xr-xphpBB/includes/search/fulltext_native.php55
-rw-r--r--phpBB/includes/ucp/ucp_zebra.php19
29 files changed, 166 insertions, 442 deletions
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index d4d4cf89b1..ccb1460c8a 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -133,7 +133,7 @@ class acp_database
$sql_data .= "# DATE : " . gmdate("d-m-Y H:i:s", $time) . " GMT\n";
$sql_data .= "#\n";
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'sqlite':
$sql_data .= "BEGIN TRANSACTION;\n";
@@ -151,7 +151,7 @@ class acp_database
break;
}
- if ($structure && SQL_LAYER == 'firebird')
+ if ($structure && $db->sql_layer == 'firebird')
{
$sql = 'SELECT RDB$FUNCTION_NAME, RDB$DESCRIPTION
FROM RDB$FUNCTIONS
@@ -181,7 +181,7 @@ class acp_database
// Get the table structure
if ($structure)
{
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'mysqli':
case 'mysql4':
@@ -224,27 +224,12 @@ class acp_database
}
$sql_data .= $this->get_table_structure($table_name);
}
- // We might wanna empty out all that junk :D
else
{
- switch (SQL_LAYER)
- {
- case 'mysqli':
- case 'mysql4':
- case 'mysql':
- case 'mssql':
- case 'mssql_odbc':
- case 'oracle':
- case 'postgres':
- case 'firebird':
- $sql_data .= 'TRUNCATE TABLE ' . $table_name . ";\n";
- break;
-
- case 'sqlite':
- $sql_data .= 'DELETE FROM ' . $table_name . ";\n";
- break;
- }
+ // We might wanna empty out all that junk :D
+ $sql_data .= (($db->sql_layer == 'sqlite') ? 'DELETE FROM ' : 'TRUNCATE TABLE ') . $table_name . ";\n";
}
+
// Now write the data for the first time. :)
if ($store == true)
{
@@ -270,7 +255,7 @@ class acp_database
{
$sql_data .= "\n";
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'mysqli':
@@ -1016,7 +1001,7 @@ class acp_database
}
}
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'sqlite':
case 'postgres':
@@ -1056,7 +1041,7 @@ class acp_database
default:
$tables = array();
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'sqlite':
$sql = "SELECT name
@@ -1247,13 +1232,13 @@ class acp_database
remove_remarks($data);
// SQLite gets improved performance when you shove all of these disk write queries at once :D
- if (SQL_LAYER == 'sqlite')
+ if ($db->sql_layer == 'sqlite')
{
$db->sql_query($data);
}
else
{
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'firebird':
$delim = ';;';
@@ -1351,7 +1336,7 @@ class acp_database
$sql_data = '';
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'mysqli':
case 'mysql4':
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index cd63f26a1b..358c0cf3cd 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -210,34 +210,8 @@ class acp_forums
$db->sql_freeresult($result);
// Now insert the data
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- if (sizeof($users_sql_ary))
- {
- $db->sql_query('INSERT INTO ' . ACL_USERS_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $users_sql_ary));
- }
-
- if (sizeof($groups_sql_ary))
- {
- $db->sql_query('INSERT INTO ' . ACL_GROUPS_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $groups_sql_ary));
- }
- break;
-
- default:
- foreach ($users_sql_ary as $ary)
- {
- $db->sql_query('INSERT INTO ' . ACL_USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
- }
-
- foreach ($groups_sql_ary as $ary)
- {
- $db->sql_query('INSERT INTO ' . ACL_GROUPS_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
- }
- break;
- }
+ $db->sql_multi_insert(ACL_USERS_TABLE, $users_sql_ary);
+ $db->sql_multi_insert(ACL_GROUPS_TABLE, $groups_sql_ary);
}
$auth->acl_clear_prefetch();
@@ -1408,7 +1382,7 @@ class acp_forums
}
$db->sql_freeresult($result);
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'mysql4':
case 'mysqli':
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index 600d596370..f4c869c40c 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -368,24 +368,7 @@ class acp_groups
$db->sql_freeresult($result);
// Now insert the data
- if (sizeof($groups_sql_ary))
- {
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- $db->sql_query('INSERT INTO ' . ACL_GROUPS_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $groups_sql_ary));
- break;
-
- default:
- foreach ($groups_sql_ary as $ary)
- {
- $db->sql_query('INSERT INTO ' . ACL_GROUPS_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
- }
- break;
- }
- }
+ $db->sql_multi_insert(ACL_GROUPS_TABLE, $groups_sql_ary);
$auth->acl_clear_prefetch();
}
diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php
index c4747a2e42..4636b067c2 100644
--- a/phpBB/includes/acp/acp_icons.php
+++ b/phpBB/includes/acp/acp_icons.php
@@ -311,7 +311,7 @@ class acp_icons
// The user has already selected a smilies_pak file
if ($current == 'delete')
{
- $db->sql_query(((SQL_LAYER != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . $table);
+ $db->sql_query((($db->sql_layer != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . $table);
switch ($mode)
{
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index d8e8cdf192..4bd230458b 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -149,7 +149,7 @@ class acp_main
break;
case 'db_track':
- $db->sql_query(((SQL_LAYER != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . TOPICS_POSTED_TABLE);
+ $db->sql_query((($db->sql_layer != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . TOPICS_POSTED_TABLE);
// This can get really nasty... therefore we only do the last six months
$get_from_time = time() - (6 * 4 * 7 * 24 * 60 * 60);
@@ -204,24 +204,7 @@ class acp_main
}
unset($posted);
- if (sizeof($sql_ary))
- {
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- $db->sql_query('INSERT INTO ' . TOPICS_POSTED_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
- break;
-
- default:
- foreach ($sql_ary as $ary)
- {
- $db->sql_query('INSERT INTO ' . TOPICS_POSTED_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
- }
- break;
- }
- }
+ $db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary);
}
add_log('admin', 'LOG_RESYNC_POST_MARKING');
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index e5b998f535..4862d3ead0 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -107,7 +107,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 (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'sqlite':
$sql = "SELECT sql
@@ -1236,7 +1236,7 @@ class acp_profile
{
global $db;
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'mysql':
case 'mysql4':
diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php
index abf554d824..0dd62b5e22 100644
--- a/phpBB/includes/acp/acp_reasons.php
+++ b/phpBB/includes/acp/acp_reasons.php
@@ -202,7 +202,7 @@ class acp_reasons
$other_reason_id = (int) $db->sql_fetchfield('reason_id');
$db->sql_freeresult($result);
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
// The ugly one!
case 'mysqli':
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index e029fb54b9..94d24e6505 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -1040,7 +1040,7 @@ class acp_users
// Update Custom Fields
if (sizeof($cp_data))
{
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'oracle':
case 'firebird':
@@ -1944,7 +1944,7 @@ class acp_users
FROM ' . ACL_OPTIONS_TABLE . "
WHERE auth_option LIKE '%\_'";
- if (SQL_LAYER == 'mssql' || SQL_LAYER == 'mssql_odbc')
+ if ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc')
{
$sql .= " ESCAPE '\\'";
}
@@ -1964,7 +1964,7 @@ class acp_users
FROM ' . ACL_OPTIONS_TABLE . "
WHERE auth_option LIKE '%\_'";
- if (SQL_LAYER == 'mssql' || SQL_LAYER == 'mssql_odbc')
+ if ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc')
{
$sql .= " ESCAPE '\\'";
}
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index 36fa5dbcea..436e3f017b 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -724,24 +724,7 @@ class auth_admin extends auth
}
}
- if (sizeof($sql_ary))
- {
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- $db->sql_query('INSERT INTO ' . ACL_OPTIONS_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
- break;
-
- default:
- foreach ($sql_ary as $ary)
- {
- $db->sql_query('INSERT INTO ' . ACL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
- }
- break;
- }
- }
+ $db->sql_multi_insert(ACL_OPTIONS_TABLE, $sql_ary);
$cache->destroy('acl_options');
$this->acl_clear_prefetch();
@@ -874,24 +857,7 @@ class auth_admin extends auth
}
}
- if (sizeof($sql_ary))
- {
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- $db->sql_query("INSERT INTO $table " . $db->sql_build_array('MULTI_INSERT', $sql_ary));
- break;
-
- default:
- foreach ($sql_ary as $ary)
- {
- $db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $ary));
- }
- break;
- }
- }
+ $db->sql_multi_insert($table, $sql_ary);
if ($clear_prefetch)
{
@@ -956,21 +922,8 @@ class auth_admin extends auth
WHERE role_id = ' . $role_id;
$db->sql_query($sql);
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- $db->sql_query('INSERT INTO ' . ACL_ROLES_DATA_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
- break;
-
- default:
- foreach ($sql_ary as $ary)
- {
- $db->sql_query('INSERT INTO ' . ACL_ROLES_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
- }
- break;
- }
+ // Now insert the new values
+ $db->sql_multi_insert(ACL_ROLES_DATA_TABLE, $sql_ary);
$this->acl_clear_prefetch();
}
@@ -1010,7 +963,7 @@ class auth_admin extends auth
$sql = 'SELECT auth_option, auth_option_id
FROM ' . ACL_OPTIONS_TABLE . "
WHERE auth_option LIKE '" . $db->sql_escape(str_replace('_', "\_", $permission_type)) . "%'";
- $sql .= (SQL_LAYER == 'mssql' || SQL_LAYER == 'mssql_odbc') ? " ESCAPE '\\'" : '';
+ $sql .= ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc') ? " ESCAPE '\\'" : '';
$result = $db->sql_query($sql);
diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php
index 8ff18bd4ec..ffce18ffb7 100644
--- a/phpBB/includes/auth.php
+++ b/phpBB/includes/auth.php
@@ -802,7 +802,7 @@ class auth
if (strpos($auth_options, '_') !== false)
{
$sql_opts = "AND $key LIKE '" . $db->sql_escape(str_replace('_', "\_", $auth_options)) . "'";
- $sql_escape = (SQL_LAYER == 'mssql' || SQL_LAYER == 'mssql_odbc') ? " ESCAPE '\\'" : '';
+ $sql_escape = ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc') ? " ESCAPE '\\'" : '';
}
else
{
@@ -848,7 +848,7 @@ class auth
if ($is_underline)
{
- $sql_escape = (SQL_LAYER == 'mssql' || SQL_LAYER == 'mssql_odbc') ? " ESCAPE '\\'" : '';
+ $sql_escape = ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc') ? " ESCAPE '\\'" : '';
}
}
}
diff --git a/phpBB/includes/cache.php b/phpBB/includes/cache.php
index 2ac8298047..8d6e17a8df 100644
--- a/phpBB/includes/cache.php
+++ b/phpBB/includes/cache.php
@@ -266,7 +266,7 @@ class cache extends acm
{
global $db;
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'mssql':
case 'mssql_odbc':
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index 732ecdfed6..cbeb3dca24 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -39,6 +39,11 @@ class dbal
var $sql_error_sql = '';
/**
+ * Current sql layer
+ */
+ var $sql_layer = '';
+
+ /**
* Constructor
*/
function dbal()
@@ -48,6 +53,10 @@ class dbal
'normal' => 0,
'total' => 0,
);
+
+ // Fill default sql layer based on the class being called.
+ // This can be changed by the specified layer itself later if needed.
+ $this->sql_layer = substr(get_class($this), 5);
}
/**
@@ -243,6 +252,12 @@ class dbal
$ary = array();
foreach ($assoc_ary as $id => $sql_ary)
{
+ // If by accident the sql array is only one-dimensional we build a normal insert statement
+ if (!is_array($sql_ary))
+ {
+ return $this->sql_build_array('INSERT', $assoc_ary);
+ }
+
$values = array();
foreach ($sql_ary as $key => $var)
{
@@ -266,6 +281,10 @@ class dbal
return $query;
}
+ /**
+ * Build IN, NOT IN, = and <> sql comparison string.
+ * @access public
+ */
function sql_in_set($field, $array, $negate = false)
{
if (!sizeof($array))
@@ -296,6 +315,47 @@ class dbal
}
/**
+ * Run more than one insert statement.
+ *
+ * @param $sql_ary array multi-dimensional array holding the statement data.
+ * @param $table string table name to run the statements on
+ *
+ * @return bool false if no statements were executed.
+ * @access public
+ */
+ function sql_multi_insert($table, &$sql_ary)
+ {
+ if (!sizeof($sql_ary))
+ {
+ return false;
+ }
+
+ switch ($this->sql_layer)
+ {
+ case 'mysql':
+ case 'mysql4':
+ case 'mysqli':
+ case 'sqlite':
+ $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('MULTI_INSERT', $sql_ary));
+ break;
+
+ default:
+ foreach ($sql_ary as $ary)
+ {
+ if (!is_array($ary))
+ {
+ return false;
+ }
+
+ $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $ary));
+ }
+ break;
+ }
+
+ return true;
+ }
+
+ /**
* Function for validating values
* @access private
*/
@@ -392,7 +452,7 @@ class dbal
if (!$this->return_on_error)
{
- $message = '<u>SQL ERROR</u> [ ' . SQL_LAYER . ' ]<br /><br />' . $error['message'] . ' [' . $error['code'] . ']';
+ $message = '<u>SQL ERROR</u> [ ' . $db->sql_layer . ' ]<br /><br />' . $error['message'] . ' [' . $error['code'] . ']';
// Show complete SQL error and path to administrators only
// Additionally show complete error on installation or if extended debug mode is enabled
@@ -491,7 +551,7 @@ class dbal
<br />
<p><b>Page generated in ' . round($totaltime, 4) . " seconds with {$this->num_queries['normal']} queries" . (($this->num_queries['cached']) ? " + {$this->num_queries['cached']} " . (($this->num_queries['cached'] == 1) ? 'query' : 'queries') . ' returning data from cache' : '') . '</b></p>
- <p>Time spent on ' . SQL_LAYER . ' queries: <b>' . round($this->sql_time, 5) . 's</b> | Time spent on PHP: <b>' . round($totaltime - $this->sql_time, 5) . 's</b></p>
+ <p>Time spent on ' . $db->sql_layer . ' queries: <b>' . round($this->sql_time, 5) . 's</b> | Time spent on PHP: <b>' . round($totaltime - $this->sql_time, 5) . 's</b></p>
<br /><br />
' . $this->sql_report . '
@@ -542,7 +602,7 @@ class dbal
else
{
$error = $this->sql_error();
- $this->sql_report .= '<b style="color: red">FAILED</b> - ' . SQL_LAYER . ' Error ' . $error['code'] . ': ' . htmlspecialchars($error['message']);
+ $this->sql_report .= '<b style="color: red">FAILED</b> - ' . $db->sql_layer . ' Error ' . $error['code'] . ': ' . htmlspecialchars($error['message']);
}
$this->sql_report .= '</p><br /><br />';
diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php
index 922a647eeb..82ff453a4c 100644
--- a/phpBB/includes/db/firebird.php
+++ b/phpBB/includes/db/firebird.php
@@ -9,20 +9,14 @@
*/
/**
+* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
-/**
-* @ignore
-*/
-if (!defined('SQL_LAYER'))
-{
-
- define('SQL_LAYER', 'firebird');
- include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
+include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/**
* Firebird/Interbase Database Abstraction Layer
@@ -389,9 +383,6 @@ class dbal_firebird extends dbal
break;
}
}
-
}
-} // if ... define
-
?> \ No newline at end of file
diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php
index 19bc3709d6..f95f99969c 100644
--- a/phpBB/includes/db/mssql.php
+++ b/phpBB/includes/db/mssql.php
@@ -9,20 +9,14 @@
*/
/**
+* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
-/**
-* @ignore
-*/
-if (!defined('SQL_LAYER'))
-{
-
- define('SQL_LAYER', 'mssql');
- include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
+include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/**
* MSSQL Database Abstraction Layer
@@ -437,9 +431,6 @@ class dbal_mssql extends dbal
break;
}
}
-
}
-} // if ... define
-
?> \ No newline at end of file
diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php
index 718bd113de..12e3ca686e 100644
--- a/phpBB/includes/db/mssql_odbc.php
+++ b/phpBB/includes/db/mssql_odbc.php
@@ -9,20 +9,14 @@
*/
/**
+* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
-/**
-* @ignore
-*/
-if (!defined('SQL_LAYER'))
-{
-
- define('SQL_LAYER', 'mssql_odbc');
- include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
+include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/**
* Unified ODBC functions
@@ -417,9 +411,6 @@ class dbal_mssql_odbc extends dbal
break;
}
}
-
}
-} // if ... define
-
?> \ No newline at end of file
diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php
index de92fd679f..56d8a419c8 100644
--- a/phpBB/includes/db/mysql.php
+++ b/phpBB/includes/db/mysql.php
@@ -9,18 +9,14 @@
*/
/**
+* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
-/**
-* @ignore
-*/
-if (!defined('SQL_LAYER'))
-{
- include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
+include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/**
* MySQL4 Database Abstraction Layer
@@ -57,16 +53,11 @@ class dbal_mysql extends dbal
if (version_compare($this->mysql_version, '4.1.3', '>='))
{
- define('SQL_LAYER', 'mysql4');
@mysql_query("SET NAMES 'utf8'", $this->db_connect_id);
}
- else if (version_compare($this->mysql_version, '4.0.0', '>='))
+ else if (version_compare($this->mysql_version, '4.0.0', '<'))
{
- define('SQL_LAYER', 'mysql4');
- }
- else
- {
- define('SQL_LAYER', 'mysql');
+ $this->sql_layer = 'mysql';
}
return $this->db_connect_id;
@@ -394,9 +385,6 @@ class dbal_mysql extends dbal
break;
}
}
-
}
-} // if ... define
-
?> \ No newline at end of file
diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php
index 5f4c0c80e5..86700744fb 100644
--- a/phpBB/includes/db/mysqli.php
+++ b/phpBB/includes/db/mysqli.php
@@ -9,20 +9,14 @@
*/
/**
+* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
-/**
-* @ignore
-*/
-if (!defined('SQL_LAYER'))
-{
-
- define('SQL_LAYER', 'mysqli');
- include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
+include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/**
* MySQLi Database Abstraction Layer
@@ -363,6 +357,4 @@ class dbal_mysqli extends dbal
}
}
-} // if ... define
-
?> \ No newline at end of file
diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php
index 0a16ca1b1e..e8a0ce3605 100644
--- a/phpBB/includes/db/oracle.php
+++ b/phpBB/includes/db/oracle.php
@@ -9,20 +9,14 @@
*/
/**
+* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
-/**
-* @ignore
-*/
-if(!defined('SQL_LAYER'))
-{
-
- define('SQL_LAYER', 'oracle');
- include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
+include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/**
* Oracle Database Abstraction Layer
@@ -507,10 +501,6 @@ class dbal_oracle extends dbal
break;
}
}
-
-
}
-} // if ... define
-
?> \ No newline at end of file
diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php
index c74adbf150..c06786a795 100644
--- a/phpBB/includes/db/postgres.php
+++ b/phpBB/includes/db/postgres.php
@@ -9,20 +9,14 @@
*/
/**
+* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
-/**
-* @ignore
-*/
-if (!defined('SQL_LAYER'))
-{
-
- define('SQL_LAYER', 'postgres');
- include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
+include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/**
* PostgreSQL Database Abstraction Layer
@@ -414,9 +408,6 @@ class dbal_postgres extends dbal
break;
}
}
-
}
-} // if ... defined
-
?> \ No newline at end of file
diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php
index 4155d35929..708376881c 100644
--- a/phpBB/includes/db/sqlite.php
+++ b/phpBB/includes/db/sqlite.php
@@ -9,20 +9,14 @@
*/
/**
+* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
-/**
-* @ignore
-*/
-if (!defined('SQL_LAYER'))
-{
-
- define('SQL_LAYER', 'sqlite');
- include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
+include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/**
* Sqlite Database Abstraction Layer
@@ -313,9 +307,6 @@ class dbal_sqlite extends dbal
break;
}
}
-
}
-} // if ... define
-
?> \ No newline at end of file
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index b050b6f5a4..ccc40d5684 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -783,24 +783,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
);
}
- if (sizeof($sql_ary))
- {
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- $db->sql_query('INSERT INTO ' . FORUMS_TRACK_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
- break;
-
- default:
- foreach ($sql_ary as $ary)
- {
- $db->sql_query('INSERT INTO ' . FORUMS_TRACK_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
- }
- break;
- }
- }
+ $db->sql_multi_insert(FORUMS_TRACK_TABLE, $sql_ary);
}
}
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
@@ -3010,7 +2993,7 @@ function page_header($page_title = '', $display_online_list = true)
$reading_sql = " AND s.session_page LIKE '%\_f\_={$f}x%'";
// Specify escape character for MSSQL
- if (SQL_LAYER == 'mssql' || SQL_LAYER == 'mssql_odbc')
+ if ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc')
{
$reading_sql .= " ESCAPE '\\'";
}
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 5bd6384f34..eebd0e2ad5 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -880,7 +880,7 @@ function delete_topic_shadows($max_age, $forum_id = '', $auto_sync = true)
{
$where = (is_array($forum_id)) ? 'AND ' . $db->sql_in_set('t.forum_id', array_map('intval', $forum_id)) : (($forum_id) ? 'AND t.forum_id = ' . (int) $forum_id : '');
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'mysql4':
case 'mysqli':
@@ -971,24 +971,7 @@ function update_posted_info(&$topic_ids)
}
unset($posted);
- if (sizeof($sql_ary))
- {
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- $db->sql_query('INSERT INTO ' . TOPICS_POSTED_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
- break;
-
- default:
- foreach ($sql_ary as $ary)
- {
- $db->sql_query('INSERT INTO ' . TOPICS_POSTED_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
- }
- break;
- }
- }
+ $db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary);
}
/**
@@ -1082,7 +1065,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
switch ($mode)
{
case 'topic_moved':
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'mysql4':
case 'mysqli':
@@ -1121,7 +1104,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
break;
case 'topic_approved':
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'mysql4':
case 'mysqli':
@@ -1956,7 +1939,7 @@ function cache_moderators()
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
// Clear table
- $db->sql_query(((SQL_LAYER != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . MODERATOR_CACHE_TABLE);
+ $db->sql_query((($db->sql_layer != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . MODERATOR_CACHE_TABLE);
// We add moderators who have forum moderator permissions without an explicit ACL_NEVER setting
$hold_ary = $ug_id_ary = $sql_ary = array();
@@ -1994,7 +1977,7 @@ function cache_moderators()
AND ' . $db->sql_in_set('ug.user_id', $ug_id_ary) . "
AND ug.user_pending = 0
AND o.auth_option LIKE 'm\_%'" .
- ((SQL_LAYER == 'mssql' || SQL_LAYER == 'mssql_odbc') ? " ESCAPE '\\'" : ''),
+ (($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc') ? " ESCAPE '\\'" : ''),
));
$result = $db->sql_query($sql);
@@ -2093,24 +2076,7 @@ function cache_moderators()
}
}
- if (sizeof($sql_ary))
- {
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- $db->sql_query('INSERT INTO ' . MODERATOR_CACHE_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
- break;
-
- default:
- foreach ($sql_ary as $ary)
- {
- $db->sql_query('INSERT INTO ' . MODERATOR_CACHE_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
- }
- break;
- }
- }
+ $db->sql_multi_insert(MODERATOR_CACHE_TABLE, $sql_ary);
}
/**
@@ -2422,7 +2388,7 @@ function get_database_size()
$database_size = false;
// This code is heavily influenced by a similar routine in phpMyAdmin 2.2.0
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'mysql':
case 'mysql4':
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 6e6cc1020e..2bdc109b96 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1708,24 +1708,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
}
- if (sizeof($sql_insert_ary))
- {
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- $db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_insert_ary));
- break;
-
- default:
- foreach ($sql_insert_ary as $ary)
- {
- $db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
- }
- break;
- }
- }
+ $db->sql_multi_insert(POLL_OPTIONS_TABLE, $sql_insert_ary);
if (sizeof($poll['poll_options']) < sizeof($cur_poll_options))
{
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index 51620349f0..66f6d63ce1 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -1389,24 +1389,7 @@ function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = tr
);
}
- if (sizeof($sql_ary))
- {
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- $db->sql_query('INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
- break;
-
- default:
- foreach ($sql_ary as $ary)
- {
- $db->sql_query('INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
- }
- break;
- }
- }
+ $db->sql_multi_insert(PRIVMSGS_TO_TABLE, $sql_ary);
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_new_privmsg = user_new_privmsg + 1, user_unread_privmsg = user_unread_privmsg + 1, user_last_privmsg = ' . time() . '
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 115165dc39..c9f5b5faf7 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -808,24 +808,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
);
}
- if (sizeof($sql_ary))
- {
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- $db->sql_query('INSERT INTO ' . BANLIST_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
- break;
-
- default:
- foreach ($sql_ary as $ary)
- {
- $db->sql_query('INSERT INTO ' . BANLIST_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
- }
- break;
- }
- }
+ $db->sql_multi_insert(BANLIST_TABLE, $sql_ary);
// If we are banning we want to logout anyone matching the ban
if (!$ban_exclude)
@@ -1719,11 +1702,11 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false,
$add_id_ary = $update_id_ary = array();
while ($row = $db->sql_fetchrow($result))
{
- $add_id_ary[] = $row['user_id'];
+ $add_id_ary[] = (int) $row['user_id'];
if ($leader && !$row['group_leader'])
{
- $update_id_ary[] = $row['user_id'];
+ $update_id_ary[] = (int) $row['user_id'];
}
}
$db->sql_freeresult($result);
@@ -1739,29 +1722,22 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false,
$db->sql_transaction('begin');
+ // Insert the new users
if (sizeof($add_id_ary))
{
- // Insert the new users
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- case 'sqlite':
- $sql = 'INSERT INTO ' . USER_GROUP_TABLE . " (user_id, group_id, group_leader, user_pending)
- VALUES " . implode(', ', preg_replace('#^([0-9]+)$#', "(\\1, $group_id, $leader, $pending)", $add_id_ary));
- $db->sql_query($sql);
- break;
+ $sql_ary = array();
- default:
- foreach ($add_id_ary as $user_id)
- {
- $sql = 'INSERT INTO ' . USER_GROUP_TABLE . " (user_id, group_id, group_leader, user_pending)
- VALUES ($user_id, $group_id, $leader, $pending)";
- $db->sql_query($sql);
- }
- break;
+ foreach ($add_id_ary as $user_id)
+ {
+ $sql_ary[] = array(
+ 'user_id' => $user_id,
+ 'group_id' => $group_id,
+ 'group_leader' => $leader,
+ 'user_pending' => $pending,
+ );
}
+
+ $db->sql_multi_insert(USER_GROUP_TABLE, $sql_ary);
}
if (sizeof($update_id_ary))
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index fc40826a74..46dfd1cf6d 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -1078,7 +1078,7 @@ class parse_message extends bbcode_firstpass
// NOTE: obtain_* function? chaching the table contents?
// For now setting the ttl to 10 minutes
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
case 'mssql':
case 'mssql_odbc':
diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php
index 27f98ebcfa..755bd5b814 100644
--- a/phpBB/includes/search/fulltext_mysql.php
+++ b/phpBB/includes/search/fulltext_mysql.php
@@ -49,7 +49,7 @@ class fulltext_mysql extends search_backend
{
global $db, $user;
- if (strpos(SQL_LAYER, 'mysql') === false)
+ if (strpos($db->sql_layer, 'mysql') === false)
{
return $user->lang['FULLTEXT_MYSQL_INCOMPATIBLE_VERSION'];
}
@@ -732,7 +732,7 @@ class fulltext_mysql extends search_backend
{
global $db;
- if (strpos(SQL_LAYER, 'mysql') === false)
+ if (strpos($db->sql_layer, 'mysql') === false)
{
$this->stats = array();
return;
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php
index f25a00687e..a845a64016 100755
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/includes/search/fulltext_native.php
@@ -596,27 +596,25 @@ class fulltext_native extends search_backend
$sql = '';
$sql_array_count = $sql_array;
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
- case 'mysql':
case 'mysql4':
case 'mysqli':
+
// 3.x does not support SQL_CALC_FOUND_ROWS
- if (SQL_LAYER != 'mysql' || $db->sql_server_info[6] != '3')
- {
- $sql_array['SELECT'] = 'SQL_CALC_FOUND_ROWS ' . $sql_array['SELECT'];
- $is_mysql = true;
+ $sql_array['SELECT'] = 'SQL_CALC_FOUND_ROWS ' . $sql_array['SELECT'];
+ $is_mysql = true;
- // that's everything for MySQL >= 4.0
- break;
- }
- // no break for MySQL 3.x
+ break;
+ case 'mysql':
case 'sqlite':
$sql_array_count['SELECT'] = ($type == 'posts') ? 'DISTINCT p.post_id' : 'DISTINCT p.topic_id';
$sql = 'SELECT COUNT(' . (($type == 'posts') ? 'post_id' : 'topic_id') . ') as total_results
FROM (' . $db->sql_build_query('SELECT', $sql_array_count) . ')';
+
// no break
+
default:
$sql_array_count['SELECT'] = ($type == 'posts') ? 'COUNT(DISTINCT p.post_id) AS total_results' : 'COUNT(DISTINCT p.topic_id) AS total_results';
$sql = (!$sql) ? $db->sql_build_query('SELECT', $sql_array_count) : $sql;
@@ -798,9 +796,8 @@ class fulltext_native extends search_backend
// If the cache was completely empty count the results
if (!$total_results)
{
- switch (SQL_LAYER)
+ switch ($db->sql_layer)
{
- case 'mysql':
case 'mysql4':
case 'mysqli':
$select = 'SQL_CALC_FOUND_ROWS ' . $select;
@@ -820,7 +817,7 @@ class fulltext_native extends search_backend
}
else
{
- if (SQL_LAYER == 'sqlite')
+ if ($db->sql_layer == 'sqlite')
{
$sql = 'SELECT COUNT(topic_id) as total_results
FROM (SELECT DISTINCT t.topic_id';
@@ -836,7 +833,7 @@ class fulltext_native extends search_backend
$m_approve_fid_sql
$sql_fora
AND t.topic_id = p.topic_id
- $sql_time" . ((SQL_LAYER == 'sqlite') ? ')' : '');
+ $sql_time" . (($db->sql_layer == 'sqlite') ? ')' : '');
}
$result = $db->sql_query($sql);
@@ -1086,26 +1083,16 @@ class fulltext_native extends search_backend
if (sizeof($new_words))
{
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- $sql = 'INSERT INTO ' . SEARCH_WORDLIST_TABLE . " (word_text)
- VALUES ('" . implode("'),('", array_map(array(&$db, 'sql_escape'), $new_words)) . "')";
- $db->sql_query($sql);
- break;
+ $sql_ary = array();
- default:
- foreach ($new_words as $word)
- {
- $sql = 'INSERT INTO ' . SEARCH_WORDLIST_TABLE . " (word_text)
- VALUES ('" . $db->sql_escape($word) . "')";
- $db->sql_query($sql);
- }
+ foreach ($new_words as $word)
+ {
+ $sql_ary[] = array('word_text' => $word);
}
+
+ $db->sql_multi_insert(SEARCH_WORDLIST_TABLE, $sql_ary);
}
- unset($new_words);
+ unset($new_words, $sql_ary);
}
// now update the search match table, remove links to removed words and add links to new words
@@ -1246,9 +1233,9 @@ class fulltext_native extends search_backend
{
global $db;
- $db->sql_query(((SQL_LAYER != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . SEARCH_WORDLIST_TABLE);
- $db->sql_query(((SQL_LAYER != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . SEARCH_WORDMATCH_TABLE);
- $db->sql_query(((SQL_LAYER != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . SEARCH_RESULTS_TABLE);
+ $db->sql_query((($db->sql_layer != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . SEARCH_WORDLIST_TABLE);
+ $db->sql_query((($db->sql_layer != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . SEARCH_WORDMATCH_TABLE);
+ $db->sql_query((($db->sql_layer != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . SEARCH_RESULTS_TABLE);
}
/**
diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php
index bf5c95d5a3..5ee28dd443 100644
--- a/phpBB/includes/ucp/ucp_zebra.php
+++ b/phpBB/includes/ucp/ucp_zebra.php
@@ -159,24 +159,7 @@ class ucp_zebra
);
}
- if (sizeof($sql_ary))
- {
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- $db->sql_query('INSERT INTO ' . ZEBRA_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
- break;
-
- default:
- foreach ($sql_ary as $ary)
- {
- $db->sql_query('INSERT INTO ' . ZEBRA_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
- }
- break;
- }
- }
+ $db->sql_multi_insert(ZEBRA_TABLE, $sql_ary);
$updated = true;
}