Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor SQL Server keyword dictionaries and MsSQL leftovers #272

Merged
merged 4 commits into from
Mar 12, 2013

Conversation

deeky666
Copy link
Member

Each Microsoft SQL Server version has its own specific reserved keyword dictionary. Therefore each platform version should implement the correct dictionary. This PR adds dedicated dictionaries for Microsoft SQL Server 2000 (base), 2005, 2008 and 2012. Moreover all the "mssql" leftovers are refactored to fit the "sqlserver" term.

@doctrinebot
Copy link

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DBAL-447

@deeky666
Copy link
Member Author

I forgot to mention that this PR also sets the new SQLServer2012Platform as default for the driver.

@stof
Copy link
Member

stof commented Feb 13, 2013

changing the default platform is a BC break, isn't it ?

*/
class MsSQLKeywords extends KeywordList
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should keep the existing class for BC (but you can make it extend the new SQLServerKeywords)

@deeky666
Copy link
Member Author

Might be, but in fact the 2012 platform just adds functionality and doesn't change or remove anything compared to 2008. So anyone who relied on 2008 until now should still be fine.

@deeky666
Copy link
Member Author

Readded MsSQLKeywords extending SQLServerKeywords and marked it as deprecated. Also added new SQL Server keyword classes to ReserveWordsCommand.

@norberttech
Copy link

@deeky666 as far as I know SQL Server 2012 supports OFFSET and FETCH(LIMIT in normal db engines) in queries which is not supported by SQL Server 2008 thats why SQLServer2008Platform needs a messy logic to handle limit queries. Changing SQL Server 2012 to a default for a driver will be BC break, maybe not now cuz OFFSET FETCH is not implemented yet but I think it will be in the future.

'NULLIF',
'OF',
'OFF',
'OFFSETS',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be OFFSET?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right! My bad, sorry ;P

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind ;)

@deeky666
Copy link
Member Author

Nope, OFFSET is not reserved by SQL Server, but OFFSETS is!
See: http://i48.tinypic.com/l8oev.png

SQL Server 2012 supports OFFSET FETCH, that's true. But why is that a BC break? As far as I can see this only affects the doModifyLimitQuery function in the 2008 platform, which should also work in 2012. Of course, the 2012 platform could be improved to make use of this new functionality.

@norberttech
Copy link

So if my application depends on SQLServer2008 platform because its default now and because I'm using SQL Server 2008 R2 it will crash after update which changes default platform to SQLServer2012. Right?

@deeky666
Copy link
Member Author

I don't think so because SQLServer2012 inherits the functionality of SQLServer2008 and doesn't change or remove any functionality of it. It only adds sequence support and some keywords.

@deeky666
Copy link
Member Author

Of course if we add OFFSET FETCH support in SQL Server 2012, BC will break.
Nevertheless you can explicitly define to use SQLServer2008Platform as your platform.

@norberttech
Copy link

And dont you think that OFFSET FETCH support will be nice feature? Just check how limit query looks in SQL Server 2008

@deeky666
Copy link
Member Author

Yeah I have seen that. I'm about to implement the new functionality for SQL Server 2012. But then we definitely have to use SQLServer2008 as default platform for the driver for BC.

@stof
Copy link
Member

stof commented Feb 13, 2013

@deeky666 It adds features, meaning the ORM can start using them as they are advocated as supported. But if you updated Doctrine in your app running SqlServer 2008, the new default will break your app.

@deeky666
Copy link
Member Author

Ok I think got your point now. I will revert the default platform for BC. Then in general (just for understanding) what kind of update strategy does Doctrine use here concerning BC? Are BC breaks allowed in new minor releases like 2.4 or 2.5?

@stof
Copy link
Member

stof commented Feb 14, 2013

no

beberlei added a commit that referenced this pull request Mar 12, 2013
Refactor SQL Server keyword dictionaries and MsSQL leftovers
@beberlei beberlei merged commit 143c251 into doctrine:master Mar 12, 2013
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants