]> git.nbdom.net Git - nb.git/commitdiff
lib/php/db/table.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 15 Jan 2018 16:50:40 +0000 (16:50 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 15 Jan 2018 16:50:40 +0000 (16:50 +0000)
lib/php/db/table.php

index dc0f7c007650cdec54dcf9964d79cbea3fbaefa5..eb538e9f0cbc1548db25549d2f2f1c229aaa101e 100644 (file)
@@ -1088,9 +1088,11 @@ Class Table extends nb {
     list($sql,$where,$limit,$select_count) = $this->rows_sql($opt);
     $st = null;
     $cursor = null;
+    $sql_orig = null;
 
     $fct = function() { return true; };
     if ($this->db()->type == 'pgsql') {
+                       $sql_orig = $sql;
        $this->db()->conn->beginTransaction();
        $sql = "DECLARE table_rows CURSOR FOR $sql";
        $cursor = $this->db()->conn->prepare($sql);
@@ -1233,8 +1235,9 @@ Class Table extends nb {
     $this->count = $opt['count'] = $count;
     $this->limit = $opt['limit'] = $limit;
 
-    if ($opt['is_html'] or $format=='wp') {
+    if ($opt['is_html'] or $format=='wp' or !empty($cursor)) {
 
+                       if (!empty($sql_orig)) $sql = $sql_orig;
       //
       // Tot
       //