mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
Changed around the limit_query() function to be easier for developers to use
This commit is contained in:
parent
3f0af80b97
commit
fc49aa8594
@ -116,6 +116,8 @@ class db {
|
||||
{
|
||||
global $phpgw_info;
|
||||
|
||||
echo '<b>Warning: limit() is no longer used, use limit_query()</b>';
|
||||
|
||||
if ($start == 0) {
|
||||
$s = "limit " . $phpgw_info["user"]["preferences"]["common"]["maxmatchs"];
|
||||
} else {
|
||||
@ -165,21 +167,37 @@ class db {
|
||||
return $this->Query_ID;
|
||||
}
|
||||
|
||||
// public: perform a query with limited result set
|
||||
function limit_query($Query_String, $offset, $num_rows, $line = '', $file = '')
|
||||
{
|
||||
global $phpgw_info;
|
||||
// public: perform a query with limited result set
|
||||
function limit_query($Query_String, $_offset, $line = '', $file = '')
|
||||
{
|
||||
global $phpgw_info;
|
||||
|
||||
if ($this->Debug)
|
||||
printf("Debug: limit_query = %s<br>offset=%d, num_rows=%d<br>\n", $Query_String, $offset, $num_rows);
|
||||
if (is_array($_offset))
|
||||
{
|
||||
list($offset,$num_rows) = $_offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
$num_rows = $phpgw_info['user']['preferences']['common']['maxmatchs'];
|
||||
$offset = $_offset;
|
||||
}
|
||||
|
||||
if (!IsSet($num_rows) || $num_rows < 1)
|
||||
$num_rows = $phpgw_info['user']['preferences']['common']['maxmatchs'];
|
||||
if ($offset == 0)
|
||||
{
|
||||
$Query_String .= ' LIMIT ' . $num_rows;
|
||||
}
|
||||
else
|
||||
{
|
||||
$Query_String .= ' LIMIT ' . $offset . ',' . $num_rows;
|
||||
}
|
||||
|
||||
$Query_String .= ' LIMIT ' . $offset . ',' . $num_rows;
|
||||
if ($this->Debug)
|
||||
{
|
||||
printf("Debug: limit_query = %s<br>offset=%d, num_rows=%d<br>\n", $Query_String, $offset, $num_rows);
|
||||
}
|
||||
|
||||
return $this->query($Query_String, $line, $file);
|
||||
}
|
||||
return $this->query($Query_String, $line, $file);
|
||||
}
|
||||
|
||||
/* public: walk result set */
|
||||
function next_record() {
|
||||
|
@ -69,6 +69,8 @@ class db {
|
||||
{
|
||||
global $phpgw_info;
|
||||
|
||||
echo '<b>Warning: limit() is no longer used, use limit_query()</b>';
|
||||
|
||||
if ($start == 0) {
|
||||
$s = "limit " . $phpgw_info["user"]["preferences"]["common"]["maxmatchs"];
|
||||
} else {
|
||||
@ -109,21 +111,37 @@ class db {
|
||||
return $this->Query_ID;
|
||||
}
|
||||
|
||||
// public: perform a query with limited result set
|
||||
function limit_query($Query_String, $offset, $num_rows, $line = '', $file = '')
|
||||
{
|
||||
global $phpgw_info;
|
||||
// public: perform a query with limited result set
|
||||
function limit_query($Query_String, $_offset, $line = '', $file = '')
|
||||
{
|
||||
global $phpgw_info;
|
||||
|
||||
if ($this->Debug)
|
||||
printf("Debug: limit_query = %s<br>offset=%d, num_rows=%d<br>\n", $Query_String, $offset, $num_rows);
|
||||
if (is_array($_offset))
|
||||
{
|
||||
list($offset,$num_rows) = $_offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
$num_rows = $phpgw_info['user']['preferences']['common']['maxmatchs'];
|
||||
$offset = $_offset;
|
||||
}
|
||||
|
||||
if (!IsSet($num_rows) || $num_rows < 1)
|
||||
$num_rows = $phpgw_info['user']['preferences']['common']['maxmatchs'];
|
||||
if ($offset == 0)
|
||||
{
|
||||
$Query_String .= ' LIMIT ' . $num_rows;
|
||||
}
|
||||
else
|
||||
{
|
||||
$Query_String .= ' LIMIT ' . $num_rows . ',' . $offset;
|
||||
}
|
||||
|
||||
$Query_String .= ' LIMIT ' . $offset . ',' . $num_rows;
|
||||
if ($this->Debug)
|
||||
{
|
||||
printf("Debug: limit_query = %s<br>offset=%d, num_rows=%d<br>\n", $Query_String, $offset, $num_rows);
|
||||
}
|
||||
|
||||
return $this->query($Query_String, $line, $file);
|
||||
}
|
||||
return $this->query($Query_String, $line, $file);
|
||||
}
|
||||
|
||||
// public: discard the query result
|
||||
function free() {
|
||||
|
Loading…
Reference in New Issue
Block a user