diff options
Diffstat (limited to 'system')
-rw-r--r-- | system/database/drivers/mysql/mysql_driver.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index a164552ed..9dc697670 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -452,7 +452,7 @@ class CI_DB_mysql_driver extends CI_DB { // This function may get "item1 item2" as a string, and so
// we may need "`item1` `item2`" and not "`item1 item2`"
- if (strpos($item, ' ') !== FALSE)
+ if (ctype_alnum($item) !== FALSE)
{
// This function may get "field >= 1", and need it to return "`field` >= 1"
if ($first_word_only === TRUE)
@@ -462,6 +462,10 @@ class CI_DB_mysql_driver extends CI_DB { $item = preg_replace('/(^|\s|\()([\w\d\-\_]+?)(\s|\)|$)/iS', '$1`$2`$3', $item);
}
+ else
+ {
+ return "`{$item}`";
+ }
$exceptions = array('AS', '/', '-', '%', '+', '*');
|