Bug #22250
closedAuto-increment does not work with driver odbc_mssql
0%
Description
When connecting to a MSSQL database using driver odbc_mssql, records are not given a proper auto-increment value (column 'uid'). Instead it is set to 0 (this has the side-effect to prevent more than 1 record to be created btw).
The sequence table is properly created though.
How to reproduce
- Drop all user tables
- Use install tool to create all tables
- Create an admin user:
- Record is created in be_users with uid = 0
- Table be_users_uid is created and initialized to 100
Do the same using native mssql driver:
- ...
- Create an adnim user:
- Record is created in be_users with uid = 1
- Table be_users_uid is created and initialized to 1
(issue imported from #M13766)
Files
Updated by Xavier Perseguers over 14 years ago
I tracked down the problem this morning while traveling by train. Problem is located in method GenID from EXT:adodb. It loops for 100 times (constant defined there) to find a free ID. It properly updates the id column in <table>_uid but fails to figure out that it succeeded and thus tries again until MAX count is reached and returns 0.
Updated by Xavier Perseguers over 14 years ago
Again in train... this time I tracked down the problem into ADOdb, in typo3/sysext/adodb/adodb/drivers/adodb-odbc.inc.php:545.
Problem is reported here: http://ch2.php.net/manual/en/function.odbc-num-rows.php
In short, many drivers return -1 with odbc_num_rows().
Updated by Xavier Perseguers over 14 years ago
Showing error message from ODBC (using odbc_errormsg()) returns
[unixODBC][FreeTDS][SQL Server]Invalid object name 'be_users_uid'.
When I debug the creation of admin user.
Updated by Xavier Perseguers over 14 years ago
Committed patch to TYPO3 Core:
- trunk (rev. 7089)
- 4-3 (rev. 7090-7091)
In addition, I contacted maintainer of ADOdb for inclusion in next release.