diff options
Diffstat (limited to 'it_dbi_postgres.class')
-rw-r--r-- | it_dbi_postgres.class | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/it_dbi_postgres.class b/it_dbi_postgres.class index b7b8851..e40729b 100644 --- a/it_dbi_postgres.class +++ b/it_dbi_postgres.class @@ -26,9 +26,9 @@ static $_global_key = 'it_dbi_postgres'; // override base class to get our own s function _where($params) { - if ($params['LIMIT'] && [$offset, $count] = it::match('^\s*(\d+)\s*,\s*(\d+)\s*$', $params['LIMIT'])) { + if ($params['LIMIT'] && ($m = it::match('^\s*(\d+)\s*,\s*(\d+)\s*$', $params['LIMIT']))) { unset($params['LIMIT']); - $params[] = " OFFSET $offset LIMIT $count"; + $params[] = " OFFSET $m[0] LIMIT $m[1]"; } return parent::_where($params); } @@ -44,7 +44,7 @@ function replace($tags = []) function _tables($p = array()) { - for ($qr = $this->query('SELECT table_name FROM information_schema.tables ' . $this->_where('table_catalog' => $this->_p['db'], 'table_schema' => 'public', $p), $p); $row = $this->_fetch_assoc($qr);) + for ($qr = $this->query('SELECT table_name FROM information_schema.tables ' . $this->_where(['table_catalog' => $this->_p['db'], 'table_schema' => 'public'], $p), $p); $row = $this->_fetch_assoc($qr);) $result[] = $row['table_name']; return (array)$result; @@ -52,7 +52,7 @@ function _tables($p = array()) function _get_field_defs() { - $where = $this->_where('t.table_name' => $this->_p['table'], 't.table_catalog' => $this->_p['db']); + $where = $this->_where(['t.table_name' => $this->_p['table'], 't.table_catalog' => $this->_p['db']]); // recreate Key column of mysql show columns $res = $this->query('SELECT column_name,constraint_type,ordinal_position FROM information_schema.table_constraints AS t JOIN information_schema.key_column_usage USING (constraint_name, constraint_schema, constraint_catalog) ' . $where); |