Subject | RE: [firebird-support] Upper case behaviour |
---|---|
Author | Svein Erling Tysvær |
Post date | 2007-12-04T14:09:09Z |
A quick search on the Internet, led me to:
http://mail-archives.apache.org/mod_mbox/db-torque-user/200607.mbox/%3CF1EF69E69C1EED4FA3BB295B07664EEE52377C@...-ag.intern%3E
where it is written (amongst other things):
"According to a quick read of the SQL 99 standard, column names are supposed to be case insensitive unless they are delimited."
and http://kurafire.net/articles/sql-convention contains:
"Say no to CamelCase
CamelCase is an often adopted naming convention, used mainly in programming languages like Java and JavaScript. Its principle is simple: start every new word with a capital letter: camelCase, myObject, someFunction, etc. But CamelCase, or any uppercase in general, is not recommended for table and column names in SQL. Why, you wonder? Well, SQL databases tend to convert all identifiers (table/column names) to lowercase unless you wrap them in quotes. So even though you create a table called Authors, it'll be made as authors. Then, if you somehow end up moving your database to a server where the SQL system is compiled to be case-sensitive, and your code has Authors everywhere, it won't work anymore. Additionally, exporting your database scheme and moving it from Windows to Linux using certain tools comes at the risk that your names will all be lowercased along the way, which will - again - make your code (with CamelCase in it) stop working. Or imagine you have a column called authorId. The capital I for id can easily look like a lowercase L in many fonts, adding to the risk of confusing other people who have to work with your code. There are just too many small risks involved in using CamelCase, so try to avoid it and stick to lowercase."
Firebird deviates from the latter recommendation by making non-quoted column names UPPERCASE and not lowercase, but I'd say this is an implementation artifact of no importance that I'd be surprised if the SQL standard cared to mention.
I doubt you'll succeed in convincing the Firebird coders to leave the case as is and not uppercase it. I agree with you that mixed case is more readable, but readability isn't a good reason for breaking the SQL standard - even as a configuration option.
Sorry,
Set
-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Eugen.Konkov@...
Sent: 4. desember 2007 13:23
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Upper case behaviour
create table "myTable" (
"fieldID" integer
)
Now this FAILs:
select * from myTable
I think it will be usefull to allow server do not UPPERCASE myTable if it without quotes
at least in my case.
it will great if I will be able to configure server like this
# Upper case object names
#DEFAULTUPPERCASE= TRUE
DEFAULTUPPERCASE= FALSE
so when I run query
select * from myTable
server will not uppercase myTable and will use object names AS IS
for example, myTable in this case
http://mail-archives.apache.org/mod_mbox/db-torque-user/200607.mbox/%3CF1EF69E69C1EED4FA3BB295B07664EEE52377C@...-ag.intern%3E
where it is written (amongst other things):
"According to a quick read of the SQL 99 standard, column names are supposed to be case insensitive unless they are delimited."
and http://kurafire.net/articles/sql-convention contains:
"Say no to CamelCase
CamelCase is an often adopted naming convention, used mainly in programming languages like Java and JavaScript. Its principle is simple: start every new word with a capital letter: camelCase, myObject, someFunction, etc. But CamelCase, or any uppercase in general, is not recommended for table and column names in SQL. Why, you wonder? Well, SQL databases tend to convert all identifiers (table/column names) to lowercase unless you wrap them in quotes. So even though you create a table called Authors, it'll be made as authors. Then, if you somehow end up moving your database to a server where the SQL system is compiled to be case-sensitive, and your code has Authors everywhere, it won't work anymore. Additionally, exporting your database scheme and moving it from Windows to Linux using certain tools comes at the risk that your names will all be lowercased along the way, which will - again - make your code (with CamelCase in it) stop working. Or imagine you have a column called authorId. The capital I for id can easily look like a lowercase L in many fonts, adding to the risk of confusing other people who have to work with your code. There are just too many small risks involved in using CamelCase, so try to avoid it and stick to lowercase."
Firebird deviates from the latter recommendation by making non-quoted column names UPPERCASE and not lowercase, but I'd say this is an implementation artifact of no importance that I'd be surprised if the SQL standard cared to mention.
I doubt you'll succeed in convincing the Firebird coders to leave the case as is and not uppercase it. I agree with you that mixed case is more readable, but readability isn't a good reason for breaking the SQL standard - even as a configuration option.
Sorry,
Set
-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Eugen.Konkov@...
Sent: 4. desember 2007 13:23
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Upper case behaviour
create table "myTable" (
"fieldID" integer
)
Now this FAILs:
select * from myTable
I think it will be usefull to allow server do not UPPERCASE myTable if it without quotes
at least in my case.
it will great if I will be able to configure server like this
# Upper case object names
#DEFAULTUPPERCASE= TRUE
DEFAULTUPPERCASE= FALSE
so when I run query
select * from myTable
server will not uppercase myTable and will use object names AS IS
for example, myTable in this case