diff options
author | Jamie Matthews <[email protected]> | 2011-01-30 15:38:23 +0000 |
---|---|---|
committer | Jamie Matthews <[email protected]> | 2011-01-30 15:38:23 +0000 |
commit | dcddc32f77d1ede57e39c11e90f666a78780b4c9 (patch) | |
tree | 27fb57fc89a61f0938fa3ac0624ca9b3ecd924cc | |
parent | 1f9d6bfda478dcf262ce3f35c5edbbb035944b65 (diff) |
Issue #12: Fix incorrect quoting of column wildcard. Thanks pewterfish.
-rw-r--r-- | idiorm.php | 3 | ||||
-rw-r--r-- | test/test_queries.php | 8 |
2 files changed, 11 insertions, 0 deletions
@@ -903,6 +903,9 @@ * character specified in the config (or autodetected). */ protected function _quote_identifier_part($part) { + if ($part === '*') { + return $part; + } $quote_character = self::$_config['identifier_quote_character']; return $quote_character . $part . $quote_character; } diff --git a/test/test_queries.php b/test/test_queries.php index e227e27..329ebc9 100644 --- a/test/test_queries.php +++ b/test/test_queries.php @@ -210,6 +210,14 @@ $expected = "DELETE FROM `widget` WHERE `id` = '1'"; Tester::check_equal("Delete data", $expected); + // Regression tests + + $widget = ORM::for_table('widget')->select('widget.*')->find_one(); + $expected = "SELECT `widget`.* FROM `widget` LIMIT 1"; + Tester::check_equal("Issue #12 - incorrect quoting of column wildcard", $expected); + + // Tests that alter Idiorm's config are done last + ORM::configure('id_column', 'primary_key'); ORM::for_table('widget')->find_one(5); $expected = "SELECT * FROM `widget` WHERE `primary_key` = '5' LIMIT 1"; |