Quoting table and column names in SQL query
#1
Posted 28 May 2012 - 07:54 PM
Note that this feature does have the side effect that it may break SQLs that use these tokens as normal string values (e.g. ... WHERE keyword LIKE '%[[something]]%'). Of course, such side effect can be worked around by using parameter binding.
What do you think about this feature? It will make writing cross-DBMS applications easier.
#2
Posted 28 May 2012 - 08:42 PM
vote+=1;
when i answer, if my answer does not make sense, don't blame on me, coz i am trying to answer to be answered;
ok, i'm covered to mess up and fooling around, yeehaw ...
#3
Posted 29 May 2012 - 03:43 AM
There are two cons:
1. IT can possible slow DB layer down.
2. You'll not be able to copy-paste SQL from code and run it your DB console or manager directly. Not a huge issue.
Questions:
1. Why [[something]] and not [something]?
#4
Posted 29 May 2012 - 06:36 AM
If turned off, no replacing should be done.
As samdark said, very nice for applications that want to support multiple dbs but not so nice for applications using one dbms.
#5
Posted 29 May 2012 - 05:27 PM
I guess the performace speed is not in question too as the quoting would be processed only if there are "placeholders" for that, if not it would be processed standard way.
#6
Posted 29 May 2012 - 07:47 PM
#7
Posted 29 May 2012 - 07:53 PM
I would like to hear more opinions about this before taking action.
#8
Posted 30 May 2012 - 02:07 AM
#9
Posted 30 May 2012 - 03:14 AM
#10
Posted 30 May 2012 - 03:16 AM
mdomba, on 30 May 2012 - 02:07 AM, said:
In the Italian keyboard layout, the backquote doesn't exist (indeed I always use the single quote ' ).
+1 for the [[ ]] solution.
#11
Posted 30 May 2012 - 03:29 AM
[] is used in MSSQL for exactly the same purpose. That's their own SQL extension and as far as I know, square brackets aren't used in other DBMs so it's safe to use just []. Less typing.
#12
Posted 30 May 2012 - 03:41 AM
samdark, on 30 May 2012 - 03:29 AM, said:
[] is used in MSSQL for exactly the same purpose. That's their own SQL extension and as far as I know, square brackets aren't used in other DBMs so it's safe to use just []. Less typing.
[ ] is used in MSSQL as a sort of escape function, so you can use reserved words inside [ ] etc.. Maybe I want to use [ ] for MSSQL statements without triggering Yii capabilities... and it would be confusing. Moreover, I prefer [[ ]] for consistency with {{ }}.

Help
This topic is locked












