1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-26 21:15:21 +02:00

sqlite support UNION ALL SELECT method

git-svn-id: file:///svn/phpbb/trunk@4203 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen
2003-07-04 17:19:00 +00:00
parent c220126bbd
commit 055fe9e82d
6 changed files with 59 additions and 56 deletions

View File

@ -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);
}

View File

@ -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

View File

@ -3,7 +3,7 @@
* admin_permissions.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* copyright : <EFBFBD> 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$

View File

@ -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)";