diff --git a/phpgwapi/inc/class.db_mysql.inc.php b/phpgwapi/inc/class.db_mysql.inc.php
index 8903edf12a..3701dc93d4 100644
--- a/phpgwapi/inc/class.db_mysql.inc.php
+++ b/phpgwapi/inc/class.db_mysql.inc.php
@@ -170,15 +170,6 @@ class db {
{
global $phpgw_info;
- if ($Query_String == '')
- return 0;
-
- if (!$this->connect())
- return 0; // we already complained in connect() about that.
-
- if ($this->Query_ID)
- $this->free();
-
if ($this->Debug)
printf("Debug: limit_query = %s
offset=%d, num_rows=%d
\n", $Query_String, $offset, $num_rows);
@@ -187,14 +178,7 @@ class db {
$Query_String .= ' LIMIT ' . $offset . ',' . $num_rows;
- $this->Query_ID = @mysql_query($Query_String, $this->Link_ID);
- $this->Row = 0;
- $this->Errno = mysql_errno();
- $this->Error = mysql_error();
- if (!$this->Query_ID)
- $this->halt('Invalid SQL: ' . $Query_String, $line, $file);
-
- return $this->Query_ID;
+ return $this->query($Query_String, $line, $file);
}
/* public: walk result set */
diff --git a/phpgwapi/inc/class.db_pgsql.inc.php b/phpgwapi/inc/class.db_pgsql.inc.php
index e96880f65e..23cd179baa 100644
--- a/phpgwapi/inc/class.db_pgsql.inc.php
+++ b/phpgwapi/inc/class.db_pgsql.inc.php
@@ -105,6 +105,22 @@ 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;
+
+ if ($this->Debug)
+ printf("Debug: limit_query = %s
offset=%d, num_rows=%d
\n", $Query_String, $offset, $num_rows);
+
+ if (!IsSet($num_rows) || $num_rows < 1)
+ $num_rows = $phpgw_info['user']['preferences']['common']['maxmatchs'];
+
+ $Query_String .= ' LIMIT ' . $offset . ',' . $num_rows;
+
+ return $this->query($Query_String, $line, $file);
+ }
+
// public: discard the query result
function free() {
@pg_freeresult($this->Query_ID);
@@ -355,4 +371,4 @@ class db {
$this->connect();
//return $return;
}
-}
\ No newline at end of file
+}