From c5e37b54c5f79913b54ba0d6cdeb66e5d637bfd1 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Wed, 20 Apr 2016 12:29:17 +0100 Subject: [PATCH] rows_sql --- lib/php/db/table.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 97c646b7..0d55567f 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -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(); -- 2.47.3