[DBAL-96] Make approach towards identifier quoting consistent Created: 26/Feb/11 Updated: 28/Apr/15
|Component/s:||Platforms, Schema Managers|
|Reporter:||Benjamin Eberlei||Assignee:||Benjamin Eberlei|
Problem: Schema is independent of a vendor, this means we have to pick a behavior, i propose SQL-92
In conjunction with the SQL reserved keywords tickets we can then improve the DatabaseDriver considerably to detect identifier casings
|Comment by Steve Müller [ 24/Dec/13 ]|
Benjamin Eberlei this is an interesting approach and I like it. But I have some complaints about it.
For 2.x we should maybe at least make use of Identifier class throughout the platforms where necessary.
|Comment by Sebastien Lavoie [ 28/Mar/15 ]|
My 2 cents:
1. Users should not have to worry about platform-specific quoting when using the query builder or helpers, the DBAL should do that for you.
|Comment by Arthur Bodera [ 28/Mar/15 ]|
Sebastien, ad 3. that is incorrect. Read the ticket more closely, look at the PR, look inside schema tool and platform classes. There is already a lot of quoting+unquoting being performed in 2.* and a lot of assumptions. Having quoting enabled across the board might actually increase performance in some cases, because there will be less scanning for keywords (see platform classes) and possibly less quoting/unquoting across Schema*.
The problem is, the quoting right now works in some places and in some platforms and is being performed only when schema/schematool/dql needs it, but is being ignored in all other cases. This means that columns like "group" or table names like "platform" will fail randomly depending on platform/rdbms you actually use. It's a nightmare with cross-platform apps and a struggle for single-platform apps, where your tables are named according to domain-rules and happen to overlap with some rdbms.
Quoting identifiers being "a bloat" is similar to saying, that implicit quoting values is a bloat. Although from security standpoint the former is much rarer, it's the same for portability and stability of the DBAL across platforms.
|Comment by Andreas Prucha [ 28/Apr/15 ]|
IMO the big problem is, that behaviour across the RDBMs may be completely different:
Some preserve case and are case-insenstive if not quoted (the nicest approach)
The biggest issue arises if the DB needs to be used outside the Doctrine-Environment and all identifiers need to be quoted in statements.