summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2008-01-16 23:18:03 +0100
committerDerek Jones <derek.jones@ellislab.com>2008-01-16 23:18:03 +0100
commitcdbdf2d30dd1dd6aff2ea25e9875814080d416e2 (patch)
treee2beee2cded3e8dc80375d59337e0b78432fb71b /system/database
parent68d021b7d83a9c9a991fc0cef8cddd8149487255 (diff)
special fix for $first_word_only to work with other changes to _protect_identifiers()
Diffstat (limited to 'system/database')
-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
{