mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 08:47:45 +02:00
- forgot to make the same change to the ODBC driver
- MySQL 3.x works now - FirebirdSQL is now on the same level as MySQL and PostgreSQL, zero hacks exist inside the core code now git-svn-id: file:///svn/phpbb/trunk@6422 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -280,7 +280,7 @@ class cache extends acm
|
||||
$sql = 'SELECT user_id, bot_agent, bot_ip
|
||||
FROM ' . BOTS_TABLE . '
|
||||
WHERE bot_active = 1
|
||||
ORDER BY STRLEN(bot_agent) DESC';
|
||||
ORDER BY CHAR_LENGTH(bot_agent) DESC';
|
||||
break;
|
||||
|
||||
// LENGTH supported by MySQL, IBM DB2 and Oracle for sure...
|
||||
|
@@ -26,7 +26,7 @@ if (!defined('SQL_LAYER'))
|
||||
|
||||
/**
|
||||
* Firebird/Interbase Database Abstraction Layer
|
||||
* Minimum Requirement is Firebird 1.5+/Interbase 7.1+
|
||||
* Minimum Requirement is Firebird 2.0
|
||||
* @package dbal
|
||||
*/
|
||||
class dbal_firebird extends dbal
|
||||
@@ -122,7 +122,8 @@ class dbal_firebird extends dbal
|
||||
}
|
||||
else
|
||||
{
|
||||
@ibase_commit();
|
||||
// way cooler than ibase_commit_ret :D
|
||||
@ibase_query('COMMIT RETAIN;');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +169,7 @@ class dbal_firebird extends dbal
|
||||
* Return number of rows
|
||||
* Not used within core code
|
||||
*/
|
||||
function sql_numrows($query_id = false)
|
||||
function sql_numrows($query_id = false)//(&$query_id)
|
||||
{
|
||||
global $cache;
|
||||
|
||||
@@ -182,6 +183,18 @@ class dbal_firebird extends dbal
|
||||
return $cache->sql_numrows($query_id);
|
||||
}
|
||||
|
||||
/*
|
||||
$num_rows = 0;
|
||||
while ($this->sql_fetchrow($query_id))
|
||||
{
|
||||
$num_rows++;
|
||||
}
|
||||
|
||||
// leave the query_id alone, it never hurt anybody
|
||||
$query_id = $this->sql_query($this->last_query_text);
|
||||
|
||||
return $num_rows;
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -120,6 +120,9 @@ class dbal_mssql_odbc extends dbal
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
|
||||
// For now, MSSQL has no real UTF-8 support
|
||||
$query = utf8_decode($query);
|
||||
|
||||
$this->last_query_text = $query;
|
||||
$this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false;
|
||||
$this->sql_add_num_queries($this->query_result);
|
||||
|
@@ -1046,21 +1046,8 @@ function display_user_activity(&$userdata)
|
||||
WHERE poster_id = ' . $userdata['user_id'] . "
|
||||
AND post_postcount = 1
|
||||
$forum_sql
|
||||
GROUP BY forum_id";
|
||||
|
||||
// Firebird does not support ORDER BY on aliased columns
|
||||
// MySQL does not support ORDER BY on functions
|
||||
switch (SQL_LAYER)
|
||||
{
|
||||
case 'firebird':
|
||||
$sql .= ' ORDER BY COUNT(post_id) DESC';
|
||||
break;
|
||||
|
||||
default:
|
||||
$sql .= ' ORDER BY num_posts DESC';
|
||||
break;
|
||||
}
|
||||
|
||||
GROUP BY forum_id
|
||||
ORDER BY num_posts DESC";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$active_f_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
@@ -1081,21 +1068,8 @@ function display_user_activity(&$userdata)
|
||||
WHERE poster_id = ' . $userdata['user_id'] . "
|
||||
AND post_postcount = 1
|
||||
$forum_sql
|
||||
GROUP BY topic_id";
|
||||
|
||||
// Firebird does not support ORDER BY on aliased columns
|
||||
// MySQL does not support ORDER BY on functions
|
||||
switch (SQL_LAYER)
|
||||
{
|
||||
case 'firebird':
|
||||
$sql .= ' ORDER BY COUNT(post_id) DESC';
|
||||
break;
|
||||
|
||||
default:
|
||||
$sql .= ' ORDER BY num_posts DESC';
|
||||
break;
|
||||
}
|
||||
|
||||
GROUP BY topic_id
|
||||
ORDER BY num_posts DESC";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$active_t_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
@@ -280,26 +280,11 @@ function mcp_post_details($id, $mode, $action)
|
||||
// but the extra size is only valuable if there are persons having more than a thousands posts.
|
||||
// This is better left to the really really big forums.
|
||||
|
||||
// Firebird does not support ORDER BY on aliased columns
|
||||
// MySQL does not support ORDER BY on functions
|
||||
switch (SQL_LAYER)
|
||||
{
|
||||
case 'firebird':
|
||||
$sql = 'SELECT poster_ip, COUNT(poster_ip) AS postings
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE poster_id = ' . $post_info['poster_id'] . '
|
||||
GROUP BY poster_ip
|
||||
ORDER BY COUNT(poster_ip) DESC';
|
||||
break;
|
||||
|
||||
default:
|
||||
$sql = 'SELECT poster_ip, COUNT(poster_ip) AS postings
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE poster_id = ' . $post_info['poster_id'] . '
|
||||
GROUP BY poster_ip
|
||||
ORDER BY postings DESC';
|
||||
break;
|
||||
}
|
||||
$sql = 'SELECT poster_ip, COUNT(poster_ip) AS postings
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE poster_id = ' . $post_info['poster_id'] . '
|
||||
GROUP BY poster_ip
|
||||
ORDER BY postings DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
|
@@ -1089,7 +1089,7 @@ class parse_message extends bbcode_firstpass
|
||||
case 'firebird':
|
||||
$sql = 'SELECT *
|
||||
FROM ' . SMILIES_TABLE . '
|
||||
ORDER BY STRLEN(code) DESC';
|
||||
ORDER BY CHAR_LENGTH(code) DESC';
|
||||
break;
|
||||
|
||||
// LENGTH supported by MySQL, IBM DB2, Oracle and Access for sure...
|
||||
|
@@ -953,11 +953,11 @@ class fulltext_native extends search_backend
|
||||
|
||||
while (isset($word[0]))
|
||||
{
|
||||
if (isset($word[252])
|
||||
if (isset($word[255])
|
||||
|| !isset($word[$isset_min]))
|
||||
{
|
||||
/**
|
||||
* Words longer than 252 bytes are ignored. This will have to be
|
||||
* Words longer than 255 bytes are ignored. This will have to be
|
||||
* changed whenever we change the length of search_wordlist.word_text
|
||||
*
|
||||
* Words shorter than $isset_min bytes are ignored, too
|
||||
@@ -1570,7 +1570,7 @@ class fulltext_native extends search_backend
|
||||
// These are fields required in the config table
|
||||
return array(
|
||||
'tpl' => $tpl,
|
||||
'config' => array('fulltext_native_load_upd' => 'bool', 'fulltext_native_min_chars' => 'integer:0:252', 'fulltext_native_max_chars' => 'integer:0:255')
|
||||
'config' => array('fulltext_native_load_upd' => 'bool', 'fulltext_native_min_chars' => 'integer:0:255', 'fulltext_native_max_chars' => 'integer:0:255')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -127,6 +127,9 @@ if (extension_loaded('mbstring'))
|
||||
/**
|
||||
* UTF-8 aware alternative to strrpos
|
||||
* Find position of last occurrence of a char in a string
|
||||
*
|
||||
* Notes:
|
||||
* - offset for mb_strrpos was added in 5.2.0, we emulate if it is lower
|
||||
*
|
||||
* @author Harry Fuecks
|
||||
* @param string haystack
|
||||
@@ -134,10 +137,9 @@ if (extension_loaded('mbstring'))
|
||||
* @param integer (optional) offset (from left)
|
||||
* @return mixed integer position or FALSE on failure
|
||||
*/
|
||||
function utf8_strrpos($str, $needle, $offset = null)
|
||||
if (version_compare(phpversion(), '5.2.0', '>='))
|
||||
{
|
||||
// offset for mb_strrpos was added in 5.2.0
|
||||
if ($offset === false || version_compare(phpversion(), '5.2.0', '>='))
|
||||
function utf8_strrpos($str, $needle, $offset = null)
|
||||
{
|
||||
// Emulate behaviour of strrpos rather than raising warning
|
||||
if (empty($str))
|
||||
@@ -147,22 +149,39 @@ if (extension_loaded('mbstring'))
|
||||
|
||||
return mb_strrpos($str, $search);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
function utf8_strrpos($str, $needle, $offset = null)
|
||||
{
|
||||
if (!is_int($offset))
|
||||
// offset for mb_strrpos was added in 5.2.0
|
||||
if ($offset === false)
|
||||
{
|
||||
trigger_error('utf8_strrpos expects parameter 3 to be long', E_USER_WARNING);
|
||||
// Emulate behaviour of strrpos rather than raising warning
|
||||
if (empty($str))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return mb_strrpos($str, $search);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!is_int($offset))
|
||||
{
|
||||
trigger_error('utf8_strrpos expects parameter 3 to be long', E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
$str = mb_substr($str, $offset);
|
||||
|
||||
if (false !== ($pos = mb_strrpos($str, $search)))
|
||||
{
|
||||
return $pos + $offset;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$str = mb_substr($str, $offset);
|
||||
|
||||
if (false !== ($pos = mb_strrpos($str, $search)))
|
||||
{
|
||||
return $pos + $offset;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user