From cdbdf2d30dd1dd6aff2ea25e9875814080d416e2 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Wed, 16 Jan 2008 22:18:03 +0000 Subject: special fix for $first_word_only to work with other changes to _protect_identifiers() --- system/database/drivers/mysql/mysql_driver.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'system/database/drivers/mysql') 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 { -- cgit v1.2.3-24-g4f1b