summaryrefslogtreecommitdiff
path: root/it_dbi.class
diff options
context:
space:
mode:
authorChristian Schneider2023-03-09 13:49:47 +0100
committerChristian Schneider2023-03-09 13:49:47 +0100
commitaa6cbf3d155f0b047321e8ea8e42d7164046b7cd (patch)
treefe3aafb9168cdd081ca2ed227f703634d216f3a0 /it_dbi.class
parentd455652427d89aa9a31776919218f20460fdc8e2 (diff)
downloaditools-aa6cbf3d155f0b047321e8ea8e42d7164046b7cd.tar.gz
itools-aa6cbf3d155f0b047321e8ea8e42d7164046b7cd.tar.bz2
itools-aa6cbf3d155f0b047321e8ea8e42d7164046b7cd.zip
Simplify escaping of int/float as we do not rely on parsing on sql side
Diffstat (limited to 'it_dbi.class')
-rw-r--r--it_dbi.class30
1 files changed, 2 insertions, 28 deletions
diff --git a/it_dbi.class b/it_dbi.class
index 2923bf3..d864a1a 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -915,26 +915,6 @@ function escape_string($str)
}
/**
- * Escapes an int for use in a DB query
- * @param The int to be quoted
- * @return The quoted value
- */
-static function escape_int($val)
-{
- return "'" . intval($val) . "'";
-}
-
-/**
- * Escapes a float for use in a DB query
- * @param The float to be quoted
- * @return The quoted value
- */
-static function escape_float($val)
-{
- return "'" . floatval($val) . "'";
-}
-
-/**
* Escapes a name/identifier for use in a DB query
* @param The identifier to be quoted
* @return The quoted value
@@ -976,15 +956,9 @@ function _get_field_info()
$this->_escapefunc[$name] = $field['_escapefunc'];
}
else if (preg_match('/^(tiny|small|medium|)int/', $field['Type']))
- {
- $this->_convertfunc[$name] = "intval";
- $this->_escapefunc[$name] = static::class . "::escape_int";
- }
+ $this->_convertfunc[$name] = $this->_escapefunc[$name] = 'intval';
else if (preg_match('/^float|^double$/', $field['Type']))
- {
- $this->_convertfunc[$name] = "floatval";
- $this->_escapefunc[$name] = static::class . "::escape_float";
- }
+ $this->_convertfunc[$name] = $this->_escapefunc[$name] = 'floatval';
}
$this->_fieldnames = "," . implode(",", array_keys((array)$this->_fields)) . ",";