[DBAL-497] SQLServerPlatform modifies limit query incorrectly when column names start with "from" Created: 18/Apr/13 Updated: 20/Apr/13 Resolved: 20/Apr/13 |
|
| Status: | Resolved |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.3.3 |
| Fix Version/s: | 2.4 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Shane Neuerburg | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | sqlserver | ||
| Environment: |
OS X using FreeTDS driver, unixODBC |
||
| Description |
|
I am working with a table that has columns that start with the word "from" (fromNumber, fromCity, etc). When SQLServerPlatform->doModifyLimitQuery is called, "from" in the names are incorrectly replaced. I suggest adding a whitespace requirement after FROM in the preg_replace on this line: So this:
$query = preg_replace('/\sFROM/i', ", ROW_NUMBER() OVER ($over) AS doctrine_rownum FROM", $query);
Becomes this:
$query = preg_replace('/\sFROM\s/i', ", ROW_NUMBER() OVER ($over) AS doctrine_rownum FROM ", $query);
|
| Comments |
| Comment by Shane Neuerburg [ 18/Apr/13 ] |
|
Pull request: |
[DBAL-482] SQL Server Schema Manager returns incorrect value for autoincrement on IDENTITY columns Created: 03/Apr/13 Updated: 01/May/13 Resolved: 01/May/13 |
|
| Status: | Resolved |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | 2.2, 2.3, 2.3.3 |
| Fix Version/s: | 2.3.4 |
| Security Level: | All |
| Type: | Bug | Priority: | Minor |
| Reporter: | William Schaller | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | schematool, sqlserver, sqlsrv | ||
| Environment: |
SQL Server |
||
| Description |
|
When calculating table diffs, SQLServerSchemaManager returns column definitions for identity columns with _autoincrement set to FALSE. This causes the schema update SQL generation to pump out a The culprit is in DBAL\Schema\SQLServerSchemaManager, starting at line 43: $dbType = strtolower($tableColumn['TYPE_NAME']);
$dbType = strtok($dbType, '(), ');
$autoincrement = false;
if (stripos($dbType, 'identity')) {
$dbType = trim(str_ireplace('identity', '', $dbType));
$autoincrement = true;
}
When the column in question is an identity int column, the TYPE_NAME is "int identity". The second line of the snippet drops the "identity" signifier, causing the following lines that determine autoincrement to do nothing. I simply moved the second line to below the autoincrement block ie: $dbType = strtolower($tableColumn['TYPE_NAME']);
$autoincrement = false;
if (stripos($dbType, 'identity')) {
$dbType = trim(str_ireplace('identity', '', $dbType));
$autoincrement = true;
}
$dbType = strtok($dbType, '(), ');
This change solves this issue for me, and as far as I can tell, has no other consequences. |
| Comments |
| Comment by Benjamin Eberlei [ 01/May/13 ] |
|
Fixed for 2.3.4 and was fixed for 2.4 in a different way already. |
[DBAL-422] Wrong VARCHAR default length in SQLServerPlatform Created: 24/Jan/13 Updated: 24/Jan/13 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.3.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Minor |
| Reporter: | Steve Müller | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | platform, sqlserver, sqlsrv, varchar | ||
| Description |
|
In SQLServerPlatform the default length for a VARCHAR declaration is set to "255". But according to the SQLServer documentation from Microsoft the default length is "1", if omitted in the declaration. I don't exactly know if the current implementation is intended, otherwise it should be fixed. I would then create an PR if desired. |