From 055fe9e82dc15c84dbdad866e8a486397d32cfe9 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Fri, 4 Jul 2003 17:19:00 +0000 Subject: sqlite support UNION ALL SELECT method git-svn-id: file:///svn/phpbb/trunk@4203 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/admin_ban.php | 5 +++-- phpBB/adm/admin_groups.php | 27 +++++++++++---------------- phpBB/adm/admin_permissions.php | 2 +- phpBB/adm/admin_search.php | 15 ++++++++++----- 4 files changed, 25 insertions(+), 24 deletions(-) (limited to 'phpBB/adm') diff --git a/phpBB/adm/admin_ban.php b/phpBB/adm/admin_ban.php index 7299e20b1c..efed0370c9 100644 --- a/phpBB/adm/admin_ban.php +++ b/phpBB/adm/admin_ban.php @@ -257,11 +257,12 @@ if (isset($_REQUEST['bansubmit'])) break; case 'mssql': + case 'sqlite': $sql .= (($sql != '') ? ' UNION ALL ' : '') . " SELECT $ban_entry, $current_time, $ban_end, $ban_exclude, '$ban_reason'"; break; default: - $sql = "INSERT INTO " . BANLIST_TABLE . " ($type, ban_start, ban_end, ban_exclude, ban_reason) + $sql = 'INSERT INTO ' . BANLIST_TABLE . " ($type, ban_start, ban_end, ban_exclude, ban_reason) VALUES ($ban_entryx, $current_time, $ban_end, $ban_exclude, '$ban_reason')"; $db->sql_query($sql); $sql = ''; @@ -270,7 +271,7 @@ if (isset($_REQUEST['bansubmit'])) if ($sql != '') { - $sql = "INSERT INTO " . BANLIST_TABLE . " ($type, ban_start, ban_end, ban_exclude, ban_reason) + $sql = 'INSERT INTO ' . BANLIST_TABLE . " ($type, ban_start, ban_end, ban_exclude, ban_reason) VALUES $sql"; $db->sql_query($sql); } diff --git a/phpBB/adm/admin_groups.php b/phpBB/adm/admin_groups.php index e0ebf48c30..5804f332d3 100644 --- a/phpBB/adm/admin_groups.php +++ b/phpBB/adm/admin_groups.php @@ -434,20 +434,6 @@ function swatch() // Insert the new users switch (SQL_LAYER) { - case 'postgresql': - case 'msaccess': - case 'mssql-odbc': - case 'oracle': - case 'db2': - foreach ($user_id_ary as $user_id) - { - $sql = "INSERT INTO $table_sql (user_id, group_id) - VALUES ($user_id, $group_id)"; - $db->sql_query($sql); - } - - break; - case 'mysql': case 'mysql4': $sql = "INSERT INTO $table_sql (user_id, group_id) @@ -456,10 +442,19 @@ function swatch() break; case 'mssql': - $sql = "INSERT INTO $table_sql (user_id, group_id) - VALUES " . implode(' UNION ALL ', preg_replace('#^([0-9]+)$#', "(\\1, $group_id)", $user_id_ary)); + case 'sqlite': + $sql = "INSERT INTO $table_sql (user_id, group_id) " . implode(' UNION ALL ', preg_replace('#^([0-9]+)$#', "(\\1, $group_id)", $user_id_ary)); $db->sql_query($sql); break; + + default: + foreach ($user_id_ary as $user_id) + { + $sql = "INSERT INTO $table_sql (user_id, group_id) + VALUES ($user_id, $group_id)"; + $db->sql_query($sql); + } + break; } // Update user settings (color, rank) if applicable diff --git a/phpBB/adm/admin_permissions.php b/phpBB/adm/admin_permissions.php index 2ad92446b4..de5da65bef 100644 --- a/phpBB/adm/admin_permissions.php +++ b/phpBB/adm/admin_permissions.php @@ -3,7 +3,7 @@ * admin_permissions.php * ------------------- * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group + * copyright : © 2001 The phpBB Group * email : support@phpbb.com * * $Id$ diff --git a/phpBB/adm/admin_search.php b/phpBB/adm/admin_search.php index 69b427caa3..32cabc8dcd 100644 --- a/phpBB/adm/admin_search.php +++ b/phpBB/adm/admin_search.php @@ -201,13 +201,16 @@ if (isset($_POST['start']) || isset($_GET['batchstart'])) { case 'mysql': case 'mysql4': - $value_sql .= (($value_sql != '') ? ', ' : '') . '(\'' . $word[$i] . '\')'; + $value_sql .= (($value_sql != '') ? ', ' : '') . "('" . $word[$i] . "')"; break; + case 'mssql': + case 'sqlite': $value_sql .= (($value_sql != '') ? ' UNION ALL ' : '') . "SELECT '" . $word[$i] . "'"; break; + default: - $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) + $sql = 'INSERT INTO ' . SEARCH_WORD_TABLE . " (word_text) VALUES ('" . $word[$i] . "')"; $db->sql_query($sql); break; @@ -221,11 +224,13 @@ if (isset($_POST['start']) || isset($_GET['batchstart'])) { case 'mysql': case 'mysql4': - $sql = "INSERT IGNORE INTO " . SEARCH_WORD_TABLE . " (word_text) + $sql = 'INSERT IGNORE INTO ' . SEARCH_WORD_TABLE . " (word_text) VALUES $value_sql"; break; + case 'mssql': - $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) + case 'sqlite': + $sql = 'INSERT INTO ' . SEARCH_WORD_TABLE . " (word_text) $value_sql"; break; } @@ -240,7 +245,7 @@ if (isset($_POST['start']) || isset($_GET['batchstart'])) if ($match_sql != '') { - $sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match) + $sql = 'INSERT INTO ' . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match) SELECT $post_id, word_id, $title_match FROM " . SEARCH_WORD_TABLE . " WHERE word_text IN ($match_sql)"; -- cgit v1.2.1