Project

General

Profile

Actions

Bug #22250

closed

Auto-increment does not work with driver odbc_mssql

Added by Xavier Perseguers over 14 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Should have
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2010-03-07
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

13766.diff (630 Bytes) 13766.diff Administrator Admin, 2010-03-08 19:15
Actions #1

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.

Actions #2

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().

Actions #3

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.

Actions #4

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.

Actions

Also available in: Atom PDF