summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2008-01-16 22:48:18 +0100
committerDerek Jones <derek.jones@ellislab.com>2008-01-16 22:48:18 +0100
commit91f50b626517ff34a0436df8e08f2dddfd2d5d7a (patch)
tree1b8d62e5d4266677926d56e78e9c7d80ecd082b9 /system/database/drivers
parent60e8d912da6380f3d9a2a1c58058cc99b70a8c45 (diff)
fix for single word identifiers with no spaces that need protecting in _protect_identifiers()
Diffstat (limited to 'system/database/drivers')
-rw-r--r--system/database/drivers/mysql/mysql_driver.php6
1 files changed, 5 insertions, 1 deletions
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', '/', '-', '%', '+', '*');