]> git.nbdom.net Git - nb.git/commitdiff
rows_sql
authorNicolas Boisselier <nicolas.boisselier@semantico.com>
Wed, 20 Apr 2016 11:29:17 +0000 (12:29 +0100)
committerNicolas Boisselier <nicolas.boisselier@semantico.com>
Wed, 20 Apr 2016 11:29:17 +0000 (12:29 +0100)
lib/php/db/table.php

index 97c646b72519dbba90548810624cc46de51477cc..0d55567f4b584534cc33942a3e7a97fbb262cc14 100644 (file)
@@ -581,14 +581,8 @@ Class Table extends nb {
   /******************************************************************
     Html Output
   ******************************************************************/
-  public function rows(&$opt=array(),$opt_by_val=null) {
-
+  public function rows_sql(&$opt=array()) {
     if (isset($this->orderby)) self::pdef('orderby',$this->orderby);
-    if ($opt_by_val !== null) $opt = $opt_by_val;
-
-    $format = $this->p('format');
-    if (!$format) bye("Invalid parameter!");
-
     //
     // Select
     //
@@ -629,6 +623,17 @@ Class Table extends nb {
     //
 # NB 28.03.16     $this->sql = $sql;
     $this->debug(preg_replace('/(,|FROM|WHERE|HAVING|GROUP|ORDER)/i',"\n\\1",$sql),1);
+    return array($sql,$where,$limit);
+  }
+
+  public function rows(&$opt=array(),$opt_by_val=null) {
+
+    if ($opt_by_val !== null) $opt = $opt_by_val;
+
+    $format = $this->p('format');
+    if (!$format) bye("Invalid parameter!");
+
+    list($sql,$where,$limit) = $this->rows_sql($opt);
     $st = $this->db()->conn->prepare($sql);
     $st->execute();