mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
The last one for today. As of now, sql_query_limit($sql, 0) will _not_ limit the number of rows that are affected.
git-svn-id: file:///svn/phpbb/trunk@3608 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
2d52ece84f
commit
575d170365
2 changed files with 9 additions and 2 deletions
|
@ -210,7 +210,6 @@ class sql_db
|
||||||
}
|
}
|
||||||
|
|
||||||
// 20030406 Ashe: switched up $total and $offset as per MySQL manual
|
// 20030406 Ashe: switched up $total and $offset as per MySQL manual
|
||||||
// Note for other DBALs: if $total == -1 we only want to set an offset (no pun intended)
|
|
||||||
function sql_query_limit($query, $total, $offset = 0, $expire_time = 0)
|
function sql_query_limit($query, $total, $offset = 0, $expire_time = 0)
|
||||||
{
|
{
|
||||||
if ($query != '')
|
if ($query != '')
|
||||||
|
@ -218,6 +217,12 @@ class sql_db
|
||||||
$this->query_result = false;
|
$this->query_result = false;
|
||||||
$this->num_queries++;
|
$this->num_queries++;
|
||||||
|
|
||||||
|
// if $total is set to 0 we do not want to limit the number of rows
|
||||||
|
if ($total == 0)
|
||||||
|
{
|
||||||
|
$total = -1;
|
||||||
|
}
|
||||||
|
|
||||||
$query .= ' LIMIT ' . ((!empty($offset)) ? "$offset, $total" : $total);
|
$query .= ' LIMIT ' . ((!empty($offset)) ? "$offset, $total" : $total);
|
||||||
|
|
||||||
return $this->sql_query($query, $expire_time);
|
return $this->sql_query($query, $expire_time);
|
||||||
|
|
|
@ -641,6 +641,8 @@ switch ($mode)
|
||||||
AND p.poster_id = u.user_id
|
AND p.poster_id = u.user_id
|
||||||
$limit_posts_time
|
$limit_posts_time
|
||||||
ORDER BY $sort_order";
|
ORDER BY $sort_order";
|
||||||
|
|
||||||
|
$start = ($posts_per_page == 0) ? 0 : $start;
|
||||||
$result = $db->sql_query_limit($sql, $posts_per_page, $start);
|
$result = $db->sql_query_limit($sql, $posts_per_page, $start);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
@ -941,7 +943,7 @@ switch ($mode)
|
||||||
$limit_posts_time
|
$limit_posts_time
|
||||||
ORDER BY $sort_order";
|
ORDER BY $sort_order";
|
||||||
}
|
}
|
||||||
$result = $db->sql_query_limit($sql, -1, $start);
|
$result = $db->sql_query_limit($sql, 0, $start);
|
||||||
|
|
||||||
$post_id_list = array();
|
$post_id_list = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
|
Loading…
Add table
Reference in a new issue