[DBAL-254] SQL Server rename table should use sp_RENAME Created: 11/Apr/12  Updated: 17/Apr/14  Resolved: 08/Jul/12

Status: Resolved
Project: Doctrine DBAL
Component/s: Platforms
Affects Version/s: 2.2.1
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Fryderyk Benigni Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None
Environment:

SQL Server 2008 R2 on windows Server



 Description   

Whenever DBAL Schema Manager tries to rename a table in sql server 2008 it should use also the sp_RENAME procedure. Otherwise error is thrown.

Apparently a similar issue was fixed for column ALTER Commands as described in the link below, but also the ALTER TABLE command should use sp_RENAME to avoid crash.

http://www.doctrine-project.org/jira/browse/DBAL-199?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel

Suggested fix for Latest DBAL 2.2

From Line 283:

$queryParts[] = 'RENAME TO ' . $diff->newName;

To Line 283:

$sql[] = 'sp_RENAME \'' . $diff->name . '\',\'' . $diff->newName.'\'';

This seems to fix the problem.

Hope this helps

Sorry for my bad english.

Fredcallagan



 Comments   
Comment by Benjamin Eberlei [ 08/Jul/12 ]

Fixed.

Generated at Tue Sep 30 16:10:25 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.