summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_dbi.class14
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.