From c5bfa400f32e623d73dabd2a43dd34c036d1efce Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Mon, 27 Jun 2016 15:16:01 +0100 Subject: [PATCH] name criteria as regexp --- lib/php/db.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/php/db.php b/lib/php/db.php index 05596e46..95da7c9b 100644 --- a/lib/php/db.php +++ b/lib/php/db.php @@ -399,11 +399,14 @@ class Db extends nb { # Filters $name = self::p('name',''); $type = self::p('type',''); + foreach ($this->tables() as $t) { - if (!empty($name) and strpos($t->name,$name) === false) continue; +# NB 27.06.16 if (!empty($name) and strpos($t->name,$name) === false) continue; + if (!empty($name) and !preg_match('/'.$name.'/',$t->name)) continue; if (!empty($type) and strpos($t->type,$type) === false) continue; $rows[] = $t->infos(); } + $return = $this->out($rows); } elseif ($action == 'db.conf') { @@ -423,7 +426,8 @@ class Db extends nb { foreach ($fields as $k) { if (!isset($d->$k)) continue; $db[$k] = $d->$k; } - if (!empty($name) and strpos($db['name'],$name) === false) continue; +# NB 27.06.16 if (!empty($name) and strpos($db['name'],$name) === false) continue; + if (!empty($name) and !preg_match('/'.$name.'/',$db['name'])) continue; if (!empty($type) and strpos($db['type'],$type) === false) continue; $dbs[] = $db; } @@ -623,7 +627,8 @@ class Db extends nb { foreach ($tables as $t) { if (!empty($tables) and empty($tables[$t->name])) continue; if (!empty($type) and strpos($t->type,$type) === false) continue; - if (!empty($name) and strpos($t->name,$name) === false) continue; +# NB 27.06.16 if (!empty($name) and strpos($t->name,$name) === false) continue; + if (!empty($name) and !preg_match('/'.$name.'/',$t->name)) continue; if ($insert) { echo "\n-- Table: ".$t->name."\n"; -- 2.47.3