summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Gass2020-09-03 15:54:39 +0200
committerNathan Gass2020-09-03 16:02:03 +0200
commit6190f37f8a6b6dadccb0766326a0ad8781670f41 (patch)
treea23de99c60cd95f9ece61c4589f0581143982e43
parentd3f0a6e4f822607b41d138afaa77081cab6afe5e (diff)
downloaditools-6190f37f8a6b6dadccb0766326a0ad8781670f41.tar.gz
itools-6190f37f8a6b6dadccb0766326a0ad8781670f41.tar.bz2
itools-6190f37f8a6b6dadccb0766326a0ad8781670f41.zip
avoid forbidden syntax
-rw-r--r--it_dbi.class2
-rw-r--r--it_dbi_postgres.class8
2 files changed, 5 insertions, 5 deletions
diff --git a/it_dbi.class b/it_dbi.class
index 5d86f12..6383910 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -415,7 +415,7 @@ function _where($params)
if ($dyncols_enabled && $this->_fields['dyncols'] && !$this->_fields[$field] && strpos($field, '(') === false)
$field = $this->_json_extract('dyncols', $field);
- else if (it::match('^\w*[A-Z]\w+$', $field, 'casesensitive' => 1))
+ else if (it::match('^\w*[A-Z]\w+$', $field, ['casesensitive' => 1]))
$field = $this->escape_name($field);
switch ($op)
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);