From aa6cbf3d155f0b047321e8ea8e42d7164046b7cd Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 9 Mar 2023 13:49:47 +0100 Subject: Simplify escaping of int/float as we do not rely on parsing on sql side --- it_dbi.class | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'it_dbi.class') diff --git a/it_dbi.class b/it_dbi.class index 2923bf3..d864a1a 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -914,26 +914,6 @@ function escape_string($str) return $this->_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 @@ -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)) . ","; -- cgit v1.2.3