Fixed bug #13766: Auto-increment does not work with driver odbc_mssql [adodb]
authorXavier Perseguers <typo3@perseguers.ch>
Mon, 8 Mar 2010 18:45:08 +0000 (18:45 +0000)
committerXavier Perseguers <typo3@perseguers.ch>
Mon, 8 Mar 2010 18:45:08 +0000 (18:45 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7089 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/adodb/adodb/drivers/adodb-odbc.inc.php

index d4bb433..7754c79 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-03-08  Xavier Perseguers  <typo3@perseguers.ch>
+
+       * Fixed bug #13766: Auto-increment does not work with driver odbc_mssql [adodb]
+
 2010-03-07  Steffen Kamper  <info@sk-typo3.de>
 
        * Updated ExtJs library from 3.1.0 to 3.1.1
index 0cb133b..573093c 100644 (file)
@@ -161,6 +161,12 @@ class ADODB_odbc extends ADOConnection {
                                $num += 1;
                                $this->genID = $num;
                                return $num;
+                       } elseif ($this->affected_rows() == 0) {
+                               // some drivers do not return a valid value => try with another method
+                               $value = $this->GetOne("select id from $seq");
+                               if ($value == $num + 1) {
+                                       return $value;
+                               }
                        }
                }
                if ($fn = $this->raiseErrorFn) {