Ciao Giuseppe!

Il 08/03/2010 10:13, Giuseppe Sacco ha scritto:
> LIMIT/OFFSET clause on postgresql manual is available at
> http://www.postgresql.org/docs/8.4/interactive/sql-select.html#SQL-LIMIT


Could you try the attacked patch please?

Cheers,
Giuseppe.
--- a/php/src/include.php
+++ b/php/src/include.php
@@ -354,10 +354,20 @@ function limit() {
 	$smarty->assign("current_page", $_GET['page']);
 
 	if($_CONF['range'] > 0) {
-		$limit = "LIMIT " .
-			 (($_GET['page'] * $_CONF['range']) - $_CONF['range']) .
-		         ", " .  
-		         $_CONF['range'];
+		if ($dbtype == "pgsql") {
+			$limit = "OFFSET " .
+				(($_GET['page'] * $_CONF['range']) - $_CONF['range']) .
+				", " .
+				$_CONF['range'] .
+				" LIMIT " .
+				$_CONF['range'];
+		}
+		else {
+			$limit = "LIMIT " .
+			 	(($_GET['page'] * $_CONF['range']) - $_CONF['range']) .
+		         	", " .
+				$_CONF['range'];
+		}
 	}
 	else {
 		$limit = "";
--- a/php/src/zonedelete.php
+++ b/php/src/zonedelete.php
@@ -14,7 +14,7 @@ if(is_admin()) {
 		is_error($res);
 		$res = $dbconnect->query("UPDATE zones " .
 					 "SET updated = 'yes'" .
-					 "LIMIT 1"
+					 "LIMIT 1 OFFSET 0"
 				   );
 		is_error($res);
 		$res = $dbconnect->query("DELETE FROM records " .

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to