From: Nicolas Boisselier Date: Wed, 20 Apr 2016 11:29:17 +0000 (+0100) Subject: rows_sql X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=c5e37b54c5f79913b54ba0d6cdeb66e5d637bfd1;p=nb.git rows_sql --- 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();