summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/database/drivers/mysql/mysql_driver.php7
1 files changed, 2 insertions, 5 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 4535e8cd4..36e365165 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -455,12 +455,9 @@ class CI_DB_mysql_driver extends CI_DB {
if (ctype_alnum($item) === FALSE)
{
// This function may get "field >= 1", and need it to return "`field` >= 1"
- if ($first_word_only === TRUE)
- {
- return '`'.preg_replace('/ /', '` ', $item, 1);
- }
+ $lbound = ($first_word_only === TRUE) ? '' : '|\s|\(';
- $item = preg_replace('/(^|\s|\()([\w\d\-\_]+?)(\s|\)|$)/iS', '$1`$2`$3', $item);
+ $item = preg_replace('/(^'.$lbound.')([\w\d\-\_]+?)(\s|\)|$)/iS', '$1`$2`$3', $item);
}
else
{