mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-06 15:45:34 +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:
parent
c220126bbd
commit
055fe9e82d
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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$
|
||||
|
@ -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)";
|
||||
|
@ -557,9 +557,11 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false)
|
||||
case 'mysql':
|
||||
case 'mysql4':
|
||||
$sql .= (($sql != '') ? ', ' : '') . '(' . $user->data['user_id'] . ', ' . $row['forum_id'] . ", $current_time)";
|
||||
$sql = 'VALUES ' . $sql;
|
||||
break;
|
||||
|
||||
case 'mssql':
|
||||
case 'sqlite':
|
||||
$sql = (($sql != '') ? ' UNION ALL ' : '') . ' SELECT ' . $user->data['user_id'] . ', ' . $row['forum_id'] . ", $current_time";
|
||||
break;
|
||||
|
||||
@ -572,8 +574,7 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false)
|
||||
|
||||
if ($sql != '')
|
||||
{
|
||||
$sql = 'INSERT INTO ' . FORUMS_TRACK_TABLE . ' (user_id, forum_id, mark_time)
|
||||
VALUES ' . $sql;
|
||||
$sql = 'INSERT INTO ' . FORUMS_TRACK_TABLE . " (user_id, forum_id, mark_time) $sql";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
@ -941,6 +942,10 @@ function login_box($s_action, $s_hidden_fields = '', $login_explain = '')
|
||||
$err = ($result === 0) ? $user->lang['ACTIVE_ERROR'] : $user->lang['LOGIN_ERROR'];
|
||||
}
|
||||
|
||||
$sql = 'DELETE FROM ' . CONFIRM_TABLE . '
|
||||
WHERE confirm_time < ' . (time() - $config['session_length']);
|
||||
// $db->sql_query($sql);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'LOGIN_ERROR' => $err,
|
||||
'LOGIN_EXPLAIN' => $login_explain,
|
||||
|
@ -286,7 +286,7 @@ class parse_message
|
||||
$conf = array('highlight.bg', 'highlight.comment', 'highlight.default', 'highlight.html', 'highlight.keyword', 'highlight.string');
|
||||
foreach ($conf as $ini_var)
|
||||
{
|
||||
ini_set($ini_var, str_replace('highlight.', 'hl_', $ini_var));
|
||||
ini_set($ini_var, str_replace('highlight.', 'syntax', $ini_var));
|
||||
}
|
||||
|
||||
ob_start();
|
||||
@ -294,16 +294,16 @@ class parse_message
|
||||
$code = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$str_from = array('<font color="hl_', '</font>', '<code>', '</code>','[', ']', '.');
|
||||
$str_to = array('<span class="hl_', '</span>', '', '', '[', ']', '.');
|
||||
$str_from = array('<font color="syntax', '</font>', '<code>', '</code>','[', ']', '.');
|
||||
$str_to = array('<span class="syntax', '</span>', '', '', '[', ']', '.');
|
||||
|
||||
if ($remove_tags)
|
||||
{
|
||||
$str_from[] = '<span class="hl_default"><?php </span>';
|
||||
$str_from[] = '<span class="syntaxdefault"><?php </span>';
|
||||
$str_to[] = '';
|
||||
$str_from[] = '<span class="hl_default"><?php ';
|
||||
$str_to[] = '<span class="hl_default">';
|
||||
$str_from[] = '<span class="hl_default">?></span>';
|
||||
$str_from[] = '<span class="syntaxdefault"><?php ';
|
||||
$str_to[] = '<span class="syntaxdefault">';
|
||||
$str_from[] = '<span class="syntaxdefault">?></span>';
|
||||
$str_to[] = '';
|
||||
}
|
||||
|
||||
@ -929,9 +929,9 @@ class fulltext_search
|
||||
$words = array();
|
||||
if ($mode == 'edit')
|
||||
{
|
||||
$sql = "SELECT w.word_id, w.word_text, m.title_match
|
||||
FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m
|
||||
WHERE m.post_id = " . intval($post_id) . "
|
||||
$sql = 'SELECT w.word_id, w.word_text, m.title_match
|
||||
FROM ' . SEARCH_WORD_TABLE . ' w, ' . SEARCH_MATCH_TABLE . " m
|
||||
WHERE m.post_id = $post_id
|
||||
AND w.word_id = m.word_id";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
@ -967,9 +967,9 @@ class fulltext_search
|
||||
// and then add (or remove) matches between the words and this post
|
||||
if (sizeof($unique_add_words))
|
||||
{
|
||||
$sql = "SELECT word_id, word_text
|
||||
FROM " . SEARCH_WORD_TABLE . "
|
||||
WHERE word_text IN (" . implode(', ', preg_replace('#^(.*)$#', '\'\1\'', $unique_add_words)) . ")";
|
||||
$sql = 'SELECT word_id, word_text
|
||||
FROM ' . SEARCH_WORD_TABLE . '
|
||||
WHERE word_text IN (' . implode(', ', preg_replace('#^(.*)$#', '\'\1\'', $unique_add_words)) . ")";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$word_ids = array();
|
||||
@ -986,30 +986,27 @@ class fulltext_search
|
||||
{
|
||||
switch (SQL_LAYER)
|
||||
{
|
||||
case 'postgresql':
|
||||
case 'msaccess':
|
||||
case 'mssql-odbc':
|
||||
case 'oracle':
|
||||
case 'db2':
|
||||
foreach ($new_words as $word)
|
||||
{
|
||||
$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
|
||||
VALUES ('" . $word . "')";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'mysql':
|
||||
case 'mysql4':
|
||||
$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
|
||||
VALUES " . implode(', ', preg_replace('#^(.*)$#', '(\'\1\')', $new_words));
|
||||
$sql = 'INSERT INTO ' . SEARCH_WORD_TABLE . ' (word_text)
|
||||
VALUES ' . implode(', ', preg_replace('#^(.*)$#', '(\'\1\')', $new_words));
|
||||
$db->sql_query($sql);
|
||||
break;
|
||||
|
||||
case 'mssql':
|
||||
$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
|
||||
VALUES " . implode(' UNION ALL ', preg_replace('#^(.*)$#', 'SELECT \'\1\'', $new_words));
|
||||
case 'sqlite':
|
||||
$sql = 'INSERT INTO ' . SEARCH_WORD_TABLE . ' (word_text) ' . implode(' UNION ALL ', preg_replace('#^(.*)$#', "SELECT '\\1'", $new_words));
|
||||
$db->sql_query($sql);
|
||||
break;
|
||||
|
||||
default:
|
||||
foreach ($new_words as $word)
|
||||
{
|
||||
$sql = 'INSERT INTO ' . SEARCH_WORD_TABLE . " (word_text)
|
||||
VALUES ('$word')";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($new_words);
|
||||
|
Loading…
x
Reference in New Issue
Block a user