diff options
author | Derek Jones <derek.jones@ellislab.com> | 2008-01-16 23:18:03 +0100 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2008-01-16 23:18:03 +0100 |
commit | cdbdf2d30dd1dd6aff2ea25e9875814080d416e2 (patch) | |
tree | e2beee2cded3e8dc80375d59337e0b78432fb71b /system | |
parent | 68d021b7d83a9c9a991fc0cef8cddd8149487255 (diff) |
special fix for $first_word_only to work with other changes to _protect_identifiers()
Diffstat (limited to 'system')
-rw-r--r-- | system/database/drivers/mysql/mysql_driver.php | 7 |
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
{
|