mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-15 21:44:56 +01:00
made sql_rowseek consistent with the dbal methods as well as fixing sql_query_limit for mssql, especially if sql_query_limit($sql, 0, 0) is given...
git-svn-id: file:///svn/phpbb/trunk@6389 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
7542fabaa7
commit
6d08ef7b3a
@ -89,7 +89,7 @@
|
||||
<input class="button2" name="add" type="submit" value="{L_BOT_ADD}" />
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="quick">
|
||||
<fieldset class="quick" style="float: right;">
|
||||
<select name="action">{S_BOT_OPTIONS}</select>
|
||||
<input class="button2" name="submit" type="submit" value="{L_SUBMIT}" />
|
||||
</fieldset>
|
||||
|
@ -424,7 +424,7 @@ class acm
|
||||
/**
|
||||
* Seek a specific row in an a cached database result (database)
|
||||
*/
|
||||
function sql_rowseek($query_id, $rownum)
|
||||
function sql_rowseek($rownum, $query_id)
|
||||
{
|
||||
if ($rownum >= sizeof($this->sql_rowset[$query_id]))
|
||||
{
|
||||
|
@ -281,7 +281,7 @@ class dbal_firebird extends dbal
|
||||
|
||||
if (isset($cache->sql_rowset[$query_id]))
|
||||
{
|
||||
return $cache->sql_rowseek($query_id, $rownum);
|
||||
return $cache->sql_rowseek($rownum, $query_id);
|
||||
}
|
||||
|
||||
// We do not fetch the row for rownum == 0 because then the next resultset would be the second row
|
||||
|
@ -172,30 +172,26 @@ class dbal_mssql extends dbal
|
||||
{
|
||||
$this->query_result = false;
|
||||
|
||||
// if $total is set to 0 we do not want to limit the number of rows
|
||||
if ($total == 0)
|
||||
// Since TOP is only returning a set number of rows we won't need it if total is set to 0 (return all rows)
|
||||
if ($total)
|
||||
{
|
||||
$total = -1;
|
||||
}
|
||||
|
||||
$row_offset = ($total) ? $offset : '';
|
||||
$num_rows = ($total) ? $total : $offset;
|
||||
|
||||
if (strpos($query, 'SELECT DISTINCT') === 0)
|
||||
{
|
||||
$query = 'SELECT DISTINCT TOP ' . ($row_offset + $num_rows) . ' ' . substr($query, 15);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = 'SELECT TOP ' . ($row_offset + $num_rows) . ' ' . substr($query, 6);
|
||||
// We need to grab the total number of rows + the offset number of rows to get the correct result
|
||||
if (strpos($query, 'SELECT DISTINCT') === 0)
|
||||
{
|
||||
$query = 'SELECT DISTINCT TOP ' . ($total + $offset) . ' ' . substr($query, 15);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = 'SELECT TOP ' . ($total + $offset) . ' ' . substr($query, 6);
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->sql_query($query, $cache_ttl);
|
||||
|
||||
// Seek by $row_offset rows
|
||||
if ($row_offset)
|
||||
// Seek by $offset rows
|
||||
if ($offset)
|
||||
{
|
||||
$this->sql_rowseek($result, $row_offset);
|
||||
$this->sql_rowseek($offset, $result);
|
||||
}
|
||||
|
||||
return $result;
|
||||
@ -313,7 +309,7 @@ class dbal_mssql extends dbal
|
||||
|
||||
if (isset($cache->sql_rowset[$query_id]))
|
||||
{
|
||||
return $cache->sql_rowseek($query_id, $rownum);
|
||||
return $cache->sql_rowseek($rownum, $query_id);
|
||||
}
|
||||
|
||||
return ($query_id) ? @mssql_data_seek($query_id, $rownum) : false;
|
||||
|
@ -168,33 +168,26 @@ class dbal_mssql_odbc extends dbal
|
||||
{
|
||||
$this->query_result = false;
|
||||
|
||||
// if $total is set to 0 we do not want to limit the number of rows
|
||||
if ($total == 0)
|
||||
// Since TOP is only returning a set number of rows we won't need it if total is set to 0 (return all rows)
|
||||
if ($total)
|
||||
{
|
||||
$total = -1;
|
||||
}
|
||||
|
||||
$row_offset = ($total) ? $offset : 0;
|
||||
$num_rows = ($total) ? $total : $offset;
|
||||
|
||||
if (strpos($query, 'SELECT DISTINCT') === 0)
|
||||
{
|
||||
$query = 'SELECT DISTINCT TOP ' . ($row_offset + $num_rows) . ' ' . substr($query, 15);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = 'SELECT TOP ' . ($row_offset + $num_rows) . ' ' . substr($query, 6);
|
||||
// We need to grab the total number of rows + the offset number of rows to get the correct result
|
||||
if (strpos($query, 'SELECT DISTINCT') === 0)
|
||||
{
|
||||
$query = 'SELECT DISTINCT TOP ' . ($total + $offset) . ' ' . substr($query, 15);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = 'SELECT TOP ' . ($total + $offset) . ' ' . substr($query, 6);
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->sql_query($query, $cache_ttl);
|
||||
|
||||
// Seek by $row_offset rows
|
||||
if ($row_offset)
|
||||
// Seek by $offset rows
|
||||
if ($offset)
|
||||
{
|
||||
for ($i = 0; $i < $row_offset; $i++)
|
||||
{
|
||||
$this->sql_fetchrow($result);
|
||||
}
|
||||
$this->sql_rowseek($offset, $result);
|
||||
}
|
||||
|
||||
return $result;
|
||||
@ -301,7 +294,7 @@ class dbal_mssql_odbc extends dbal
|
||||
|
||||
if (isset($cache->sql_rowset[$query_id]))
|
||||
{
|
||||
return $cache->sql_rowseek($query_id, $rownum);
|
||||
return $cache->sql_rowseek($rownum, $query_id);
|
||||
}
|
||||
|
||||
$this->sql_freeresult($query_id);
|
||||
|
@ -249,7 +249,7 @@ class dbal_mysql extends dbal
|
||||
{
|
||||
if (isset($cache->sql_rowset[$query_id]))
|
||||
{
|
||||
$cache->sql_rowseek($query_id, $rownum);
|
||||
$cache->sql_rowseek($rownum, $query_id);
|
||||
return $cache->sql_fetchfield($query_id, $field);
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ class dbal_mysql extends dbal
|
||||
|
||||
if (isset($cache->sql_rowset[$query_id]))
|
||||
{
|
||||
return $cache->sql_rowseek($query_id, $rownum);
|
||||
return $cache->sql_rowseek($rownum, $query_id);
|
||||
}
|
||||
|
||||
return ($query_id) ? @mysql_data_seek($query_id, $rownum) : false;
|
||||
|
@ -252,7 +252,7 @@ class dbal_mysql4 extends dbal
|
||||
{
|
||||
if (isset($cache->sql_rowset[$query_id]))
|
||||
{
|
||||
$cache->sql_rowseek($query_id, $rownum);
|
||||
$cache->sql_rowseek($rownum, $query_id);
|
||||
return $cache->sql_fetchfield($query_id, $field);
|
||||
}
|
||||
|
||||
@ -278,7 +278,7 @@ class dbal_mysql4 extends dbal
|
||||
|
||||
if (isset($cache->sql_rowset[$query_id]))
|
||||
{
|
||||
return $cache->sql_rowseek($query_id, $rownum);
|
||||
return $cache->sql_rowseek($rownum, $query_id);
|
||||
}
|
||||
|
||||
return ($query_id) ? @mysql_data_seek($query_id, $rownum) : false;
|
||||
|
@ -270,7 +270,7 @@ class dbal_mysqli extends dbal
|
||||
|
||||
if (!is_object($query_id) && isset($cache->sql_rowset[$query_id]))
|
||||
{
|
||||
return $cache->sql_rowseek($query_id, $rownum);
|
||||
return $cache->sql_rowseek($rownum, $query_id);
|
||||
}
|
||||
|
||||
return ($query_id) ? @mysqli_data_seek($query_id, $rownum) : false;
|
||||
|
@ -403,7 +403,7 @@ class dbal_oracle extends dbal
|
||||
|
||||
if (isset($cache->sql_rowset[$query_id]))
|
||||
{
|
||||
return $cache->sql_rowseek($query_id, $rownum);
|
||||
return $cache->sql_rowseek($rownum, $query_id);
|
||||
}
|
||||
|
||||
if (!$query_id)
|
||||
|
@ -319,7 +319,7 @@ class dbal_postgres extends dbal
|
||||
|
||||
if (isset($cache->sql_rowset[$query_id]))
|
||||
{
|
||||
return $cache->sql_rowseek($query_id, $rownum);
|
||||
return $cache->sql_rowseek($rownum, $query_id);
|
||||
}
|
||||
|
||||
return ($query_id) ? @pg_result_seek($query_id, $rownum) : false;
|
||||
|
@ -266,7 +266,7 @@ class dbal_sqlite extends dbal
|
||||
|
||||
if (isset($cache->sql_rowset[$query_id]))
|
||||
{
|
||||
return $cache->sql_rowseek($query_id, $rownum);
|
||||
return $cache->sql_rowseek($rownum, $query_id);
|
||||
}
|
||||
|
||||
return ($query_id) ? @sqlite_seek($query_id, $rownum) : false;
|
||||
|
@ -1358,11 +1358,6 @@ class smtp_class
|
||||
*/
|
||||
function mail_encode($str)
|
||||
{
|
||||
if ($encoding == '')
|
||||
{
|
||||
return $str;
|
||||
}
|
||||
|
||||
// define start delimimter, end delimiter and spacer
|
||||
$end = "?=";
|
||||
$start = "=?UTF-8?B?";
|
||||
|
@ -364,7 +364,7 @@ function close_report($post_id_list, $mode, $action)
|
||||
trigger_error('NOT_AUTHORIZED');
|
||||
}
|
||||
|
||||
if (($action == 'delete') && (strpos($user->data['session_page'], 'mode=report_details') !== false))
|
||||
if ($action == 'delete' && strpos($user->data['session_page'], 'mode=report_details') !== false)
|
||||
{
|
||||
$redirect = request_var('redirect', build_url(array('mode')) . '&mode=reports');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user