[BUGFIX] DBAL: Remove quoting from tablename for sequences 27/36827/9
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Wed, 11 Feb 2015 13:12:09 +0000 (14:12 +0100)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Mon, 28 Sep 2015 05:51:55 +0000 (07:51 +0200)
Trim the quotes from the tables names when creating sequences, otherwise
the SQL statements are broken. Also, the bogus sequence prefix is
removed from the trigger name.

Resolves: #64990
Releases: master
Change-Id: I65319b5de5054914e2bf57226586cfe0cebfab30
Reviewed-on: http://review.typo3.org/36827
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
typo3/sysext/adodb/Documentation/Index.rst
typo3/sysext/adodb/Documentation/typo3-adodb.diff
typo3/sysext/adodb/adodb/datadict/datadict-oci8.inc.php

index ae7b4c1..3c072bf 100644 (file)
@@ -23,6 +23,7 @@ updated to upstream.
 - ADOdb: mssqlnative driver is not properly initialized (66830_)
 - ADOdb: mssqlnative driver does not properly define the port (63070_)
 - ADOdb: Allow setting NOT NULL/DEFAULT on blob and text columns (67442_) (Upstream pull request: [3]_)
+- ADOdb: Table names in sequences broken (64990_)
 
 .. [2] https://github.com/ADOdb/ADOdb/commit/85f05a98974ea85ecae943faf230a27afdbaa746
 .. [3] https://github.com/ADOdb/ADOdb/pull/118
@@ -34,6 +35,7 @@ updated to upstream.
 .. _66830: https://forge.typo3.org/issues/66830
 .. _63070: https://forge.typo3.org/issues/63070
 .. _67442: https://forge.typo3.org/issues/67442
+.. _64990: https://forge.typo3.org/issues/64990
 
 
 Diff
index aedda14..cb85d04 100644 (file)
@@ -350,3 +350,46 @@ index 965314d..3556825 100644
  
        function MetaType($t,$len=-1,$fieldobj=false)
        {
+diff --git a/datadict/datadict-oci8.inc.php b/datadict/datadict-oci8.inc.php
+index e7b4c2b..3453d4c 100644
+--- a/datadict/datadict-oci8.inc.php
++++ b/datadict/datadict-oci8.inc.php
+@@ -196,23 +196,28 @@ end;
+       {
+               if (!$this->seqField) return array();
+
++              $sequenceTriggerTableName = trim($tabname, $this->connection->nameQuote);
+               if ($this->schema) {
+-                      $t = strpos($tabname,'.');
+-                      if ($t !== false) $tab = substr($tabname,$t+1);
+-                      else $tab = $tabname;
+-                      $seqname = $this->schema.'.'.$this->seqPrefix.$tab;
+-                      $trigname = $this->schema.'.'.$this->trigPrefix.$this->seqPrefix.$tab;
++                      $t = strpos($tabname, '.');
++                      if ($t !== FALSE) {
++                              $tab = substr($sequenceTriggerTableName, $t + 1);
++                      } else {
++                              $tab = $sequenceTriggerTableName;
++                      }
++                      $seqname = $this->schema . '.' . $this->seqPrefix . $tab;
++                      $trigname = $this->schema . '.' . $this->trigPrefix . $tab;
+               } else {
+-                      $seqname = $this->seqPrefix.$tabname;
+-                      $trigname = $this->trigPrefix.$seqname;
++                      $seqname = $this->seqPrefix . $sequenceTriggerTableName;
++                      $trigname = $this->trigPrefix . $sequenceTriggerTableName;
+               }
+
+               if (strlen($seqname) > 30) {
+-                      $seqname = $this->seqPrefix.uniqid('');
+-              } // end if
++                      $seqname = $this->seqPrefix . uniqid('');
++              }
+               if (strlen($trigname) > 30) {
+-                      $trigname = $this->trigPrefix.uniqid('');
+-              } // end if
++                      $trigname = $this->trigPrefix . uniqid('');
++              }
+
+               if (isset($tableoptions['REPLACE'])) $sql[] = "DROP SEQUENCE $seqname";
+               $seqCache = '';
\ No newline at end of file
index e7b4c2b..a7d76be 100644 (file)
@@ -196,23 +196,27 @@ end;
        {
                if (!$this->seqField) return array();
 
+               $sequenceTriggerTableName = trim($tabname, $this->connection->nameQuote);
                if ($this->schema) {
-                       $t = strpos($tabname,'.');
-                       if ($t !== false) $tab = substr($tabname,$t+1);
-                       else $tab = $tabname;
-                       $seqname = $this->schema.'.'.$this->seqPrefix.$tab;
-                       $trigname = $this->schema.'.'.$this->trigPrefix.$this->seqPrefix.$tab;
+                       $t = strpos($tabname, '.');
+                       if ($t !== FALSE) {
+                               $tab = substr($sequenceTriggerTableName, $t + 1);
+                       } else {
+                               $tab = $sequenceTriggerTableName;
+                       }
+                       $seqname = $this->schema . '.' . $this->seqPrefix . $tab;
+                       $trigname = $this->schema . '.' . $this->trigPrefix . $tab;
                } else {
-                       $seqname = $this->seqPrefix.$tabname;
-                       $trigname = $this->trigPrefix.$seqname;
+                       $seqname = $this->seqPrefix . $sequenceTriggerTableName;
+                       $trigname = $this->trigPrefix . $sequenceTriggerTableName;
                }
 
                if (strlen($seqname) > 30) {
-                       $seqname = $this->seqPrefix.uniqid('');
-               } // end if
+                       $seqname = $this->seqPrefix . uniqid('');
+               }
                if (strlen($trigname) > 30) {
-                       $trigname = $this->trigPrefix.uniqid('');
-               } // end if
+                       $trigname = $this->trigPrefix . uniqid('');
+               }
 
                if (isset($tableoptions['REPLACE'])) $sql[] = "DROP SEQUENCE $seqname";
                $seqCache = '';