From 91f50b626517ff34a0436df8e08f2dddfd2d5d7a Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Wed, 16 Jan 2008 21:48:18 +0000 Subject: fix for single word identifiers with no spaces that need protecting in _protect_identifiers() --- system/database/drivers/mysql/mysql_driver.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'system/database/drivers/mysql/mysql_driver.php') 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', '/', '-', '%', '+', '*'); -- cgit v1.2.3-24-g4f1b