diff options
author | Nathan Gass | 2020-09-03 10:29:17 +0200 |
---|---|---|
committer | Nathan Gass | 2020-09-03 10:29:17 +0200 |
commit | 7c1f8a89cff2ef27658196cf4391f7535ce3bf60 (patch) | |
tree | 95e1e8941aea00a5c95730f2239a34cb2fa5e28d /it_dbi.class | |
parent | 696bf01dbfb4097580c9b41e7249424d687e44c9 (diff) | |
download | itools-7c1f8a89cff2ef27658196cf4391f7535ce3bf60.tar.gz itools-7c1f8a89cff2ef27658196cf4391f7535ce3bf60.tar.bz2 itools-7c1f8a89cff2ef27658196cf4391f7535ce3bf60.zip |
make sure connection exists for escape_name same as escape_string
Diffstat (limited to 'it_dbi.class')
-rw-r--r-- | it_dbi.class | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/it_dbi.class b/it_dbi.class index 217b572..d84c194 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -306,7 +306,7 @@ function _set($tags, $force = false) { $expressions = $this->_expressions($tags, $force); - return $expressions ? 'SET ' . implode(', ', it::map(fn ($k, $v) => $this->_escape_name($k) . "=$v", $expressions)) : ''; + return $expressions ? 'SET ' . implode(', ', it::map(fn ($k, $v) => $this->escape_name($k) . "=$v", $expressions)) : ''; } /** @@ -319,7 +319,7 @@ function _values($tags, $force = false) $result = ''; if ($expressions) - $result = '(' . implode(', ', it::map(fn ($k) => $this->_escape_name($k), $expressions)) . ') VALUES (' . implode(', ', array_values($expressions)) . ')'; + $result = '(' . implode(', ', it::map(fn ($k) => $this->escape_name($k), $expressions)) . ') VALUES (' . implode(', ', array_values($expressions)) . ')'; return $result; } @@ -910,6 +910,16 @@ function escape_string($str) return $this->_escape_string($str); } +/** + * Escapes a name/identifier for use in a DB query + * @param The identifier to be quoted + * @return The quoted value + */ +function escape_name($str) +{ + $this->_connect(); + return $this->_escape_name($str); +} /** * INTERNAL: Store information about a table's fields in $this->_fields, possibly from cache. |