From 3db4daffff1cbb6d2262a1caa873569b0d0a315a Mon Sep 17 00:00:00 2001 From: David Flatz Date: Mon, 13 Aug 2018 11:52:28 +0200 Subject: disable dyncols in WHERE when we have multiple tables because we can't trust _fields anymore and columns might be prefixed with tablename --- it_dbi.class | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'it_dbi.class') diff --git a/it_dbi.class b/it_dbi.class index be802b7..156c487 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -326,6 +326,7 @@ function _from($params, $omit_from = false) */ function _where($params) { + $dyncols_enabled = !strlen($params['JOIN'] . $params['FROM']); unset($params['JOIN'], $params['FROM']); if (is_array($params) && (count($params) > 0)) @@ -372,7 +373,7 @@ function _where($params) $qval = $this->escape_string((string)$value); } - if ($this->_fields['dyncols'] && !$this->_fields[$field]) + if ($dyncols_enabled && $this->_fields['dyncols'] && !$this->_fields[$field]) $field = "JSON_EXTRACT(dyncols, " . $this->escape_string('$.' . $field) . ")"; switch ($op) -- cgit v1.2.3