Fixed bug #13422: Invalid quoting of numeric column names
authorXavier Perseguers <typo3@perseguers.ch>
Fri, 5 Feb 2010 08:27:39 +0000 (08:27 +0000)
committerXavier Perseguers <typo3@perseguers.ch>
Fri, 5 Feb 2010 08:27:39 +0000 (08:27 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/dbal/trunk@29688 735d13b6-9817-0410-8766-e36946ffe9aa

typo3/sysext/dbal/ChangeLog
typo3/sysext/dbal/class.ux_t3lib_db.php
typo3/sysext/dbal/tests/db_oracle_testcase.php

index 3f6ff07..8025621 100644 (file)
@@ -1,3 +1,7 @@
+2010-02-05  Xavier Perseguers  <typo3@perseguers.ch>
+
+       * Fixed bug #13422: Invalid quoting of numeric column names
+
 2010-02-03  Xavier Perseguers  <typo3@perseguers.ch>
 
        * Added unit tests for bug #13412: BETWEEN operator is not supported
index e72924d..c5a025e 100644 (file)
@@ -1040,10 +1040,10 @@ class ux_t3lib_DB extends t3lib_DB {
         */
        protected function _quoteFieldNames(array $select_fields) {
                foreach ($select_fields as $k => $v) {
-                       if ($select_fields[$k]['field'] != '' && $select_fields[$k]['field'] != '*') {
+                       if ($select_fields[$k]['field'] != '' && $select_fields[$k]['field'] != '*' && !is_numeric($select_fields[$k]['field'])) {
                                $select_fields[$k]['field'] = $this->quoteName($select_fields[$k]['field']);
                        }
-                       if ($select_fields[$k]['table'] != '') {
+                       if ($select_fields[$k]['table'] != '' && !is_numeric($select_fields[$k]['table'])) {
                                $select_fields[$k]['table'] = $this->quoteName($select_fields[$k]['table']);
                        }
                        if ($select_fields[$k]['as'] != '') {
index d10b062..54f1860 100644 (file)
@@ -253,6 +253,20 @@ class db_oracle_testcase extends BaseTestCase {
                $this->assertEquals($expected, $query);
        }
 
+       /**
+        * @test
+        * http://bugs.typo3.org/view.php?id=13422
+        */
+       public function numericColumnsAreNotQuoted() {
+               $query = $this->cleanSql($GLOBALS['TYPO3_DB']->SELECTquery(
+                       '1',
+                       'be_users',
+                       'username = \'_cli_scheduler\' AND admin = 0 AND be_users.deleted = 0'
+               ));
+               $expected = 'SELECT 1 FROM "be_users" WHERE "username" = \'_cli_scheduler\' AND "admin" = 0 AND "be_users"."deleted" = 0';
+               $this->assertEquals($expected, $query);
+       }
+
        ///////////////////////////////////////
        // Tests concerning remapping
        ///////////////////////////////////////