diff options
-rw-r--r-- | it_dbi.class | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/it_dbi.class b/it_dbi.class index 1b749eb..d498090 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -115,10 +115,8 @@ function createclasses($p = array()) if (!$tables = $state['tables']) { - for ($tables = array(), $res = $dbi->query('SHOW TABLES', $p); $row = mysqli_fetch_row($res);) - $tables[] = $row[0]; - - $state = it_dbi::_state_get($dbid); # State could have been modified by query above + $tables = $dbi->tables($p); + $state = it_dbi::_state_get($dbid); # State could have been modified by $db->ables() call $state['tables'] = $tables; it_dbi::_state_put($dbid, $state); } @@ -422,6 +420,18 @@ function _write_pre_process(&$tags, $command) # NOPHPLINT /** + * Return an array of all tables of this database + */ +function tables($p = array()) +{ + for ($qr = $this->query('SHOW TABLES', $p); $row = mysqli_fetch_row($qr);) + $result[] = $row[0]; + + return (array)$result; +} + + +/** * Clear record */ function clear($pp = true) |