diff options
-rw-r--r-- | it_dbi.class | 2 | ||||
-rwxr-xr-x | test/it_dbi.t | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/it_dbi.class b/it_dbi.class index 76f4d1a..d3dbc11 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -383,7 +383,7 @@ function _where($params) $qval = $this->escape_string((string)$value); } - if ($dyncols_enabled && $this->_fields['dyncols'] && !$this->_fields[$field]) + if ($dyncols_enabled && $this->_fields['dyncols'] && !$this->_fields[$field] && strpos($field, '(') === false) $field = "JSON_EXTRACT(dyncols, " . $this->escape_string('$.' . $field) . ")"; switch ($op) diff --git a/test/it_dbi.t b/test/it_dbi.t index a257105..6214716 100755 --- a/test/it_dbi.t +++ b/test/it_dbi.t @@ -377,6 +377,8 @@ is($r->select(['-key1 IS NOT' => 'NULL']), 0, 'no entry should have a value for is($r->_where(['FROM' => 'it_dbi_test AS a, it_dbi_test AS b', '-a.ID' => 'b.ID']), 'WHERE a.ID = b.ID', "don't do JSON_EXTRACT when we have multiple tables in FROM"); is($r->_where(['JOIN' => 'it_dbi_test AS b', '-a.ID' => 'b.ID']), 'WHERE a.ID = b.ID', "don't do JSON_EXTRACT when we JOIN"); +is($r->_where(['LOWER(a)' => 'x']), "WHERE LOWER(a) = 'x'", "don't do JSON_EXTRACT when we use SQL functions"); + # # Test tracked update # |