summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_dbi.class5
1 files changed, 5 insertions, 0 deletions
diff --git a/it_dbi.class b/it_dbi.class
index c814aa6..7bed262 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -43,6 +43,7 @@ class it_dbi
var $_key; # Key of currently loaded record or null (public readonly)
var $_fields; # Array of name => array(Field,Type,Null,Key,Default,Extra,Length) of fields (public readonly)
+ var $_fieldnames; # All field names in schema for case mismatch alert
var $_convertfunc; # Array of name => convert function (currently intval and floatval) for this field's values
var $_link; # DB link identifier (private)
var $_dbid; # string identifying db connection. used for _state_purgeshared from outside
@@ -245,6 +246,9 @@ function _set($tags, $allfields = false)
$result = array();
foreach((array)$tags as $field => $value)
{
+ if (!$this->_fields[trim($field, "-")] && it::match("," . trim($field, "-") . ",", $this->_fieldnames))
+ it::error("case mismatch on field " . trim($field, "-") . ", valid fields $this->_fieldnames");
+
if (substr($field, 0, 1) === "-" && !$this->_fields[trim($field, "-")] && $this->_fields['dyncols'])
$dyns[] = $this->escape_string(trim($field, "-")) . ", $value";
else if (substr($field, 0, 1) === '-') # Unquoted value (always added)
@@ -834,6 +838,7 @@ function _get_field_info()
if (preg_match('/^(tiny|small|medium|)int|^float|^double/', $field['Type']))
$this->_convertfunc[$field['Field']] = it::match('int', $field['Type']) ? "intval" : "floatval";
}
+ $this->_fieldnames = "," . join(",", array_keys((array)$this->_fields)) . ",";
# Consider all fields which have _{localized_defaultlanguage} suffix as localized
foreach (preg_grep('/_' . $this->_p['localized_defaultlanguage'] . '$/', array_keys((array)$this->_fields)) as $field)