diff --git a/classes/xml/xmlquery/DBParser.class.php b/classes/xml/xmlquery/DBParser.class.php
index 111f698f4..a8f961371 100644
--- a/classes/xml/xmlquery/DBParser.class.php
+++ b/classes/xml/xmlquery/DBParser.class.php
@@ -144,7 +144,7 @@
if(strpos($match,')') !== false) continue;
if(in_array($match, array(',', '.'))) continue;
if($brackets == $total_brackets){
- if(!is_numeric($match)) {
+ if(!is_numeric($match) && !in_array(strtoupper($match), array('UNSIGNED', 'INTEGER', 'AS'))) {
$match = $this->escapeColumnExpression($match);
}
}
diff --git a/tests/classes/db/db/xml_query/mysql/MysqlSelectTest.php b/tests/classes/db/db/xml_query/mysql/MysqlSelectTest.php
index 11741a2eb..6471e8022 100644
--- a/tests/classes/db/db/xml_query/mysql/MysqlSelectTest.php
+++ b/tests/classes/db/db/xml_query/mysql/MysqlSelectTest.php
@@ -380,4 +380,26 @@ class MysqlSelectTest extends MysqlTest {
limit 5";
$this->_test($xml_file, $argsString, $expected);
}
+
+ /**
+ * Add support for CAST / CONVERT function
+ */
+ function testCast()
+ {
+ $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/cast.xml";
+ $argsString = '';
+ $expected = "select cast(`document_srl` as unsigned integer) from `xe_documents` as `documents`";
+ $this->_test($xml_file, $argsString, $expected);
+ }
+
+ /**
+ * Add support for CAST / CONVERT function
+ */
+ function testConvert()
+ {
+ $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/convert.xml";
+ $argsString = '';
+ $expected = "select convert(`document_srl`, unsigned integer) from `xe_documents` as `documents`";
+ $this->_test($xml_file, $argsString, $expected);
+ }
}
\ No newline at end of file
diff --git a/tests/classes/db/db/xml_query/mysql/data/cast.xml b/tests/classes/db/db/xml_query/mysql/data/cast.xml
new file mode 100644
index 000000000..9049dbe1b
--- /dev/null
+++ b/tests/classes/db/db/xml_query/mysql/data/cast.xml
@@ -0,0 +1,8 @@
+
diff --git a/tests/classes/db/db/xml_query/mysql/data/convert.xml b/tests/classes/db/db/xml_query/mysql/data/convert.xml
new file mode 100644
index 000000000..96d982717
--- /dev/null
+++ b/tests/classes/db/db/xml_query/mysql/data/convert.xml
@@ -0,0 +1,8 @@
+