Subject | Re: [firebird-support] Upper case behaviour |
---|---|
Author | Eugen.Konkov@aldec.com |
Post date | 2007-12-04T19:02:18Z |
Always quoting is not problem.
Suppose that you are supporting now case-preserving
create table myTable (
fieldID integer
);
This query will create table 'myTable' with field 'fieldID' in DB
somewhere in programm there will be next query:
select fieldID from myTable;
as FireBird is already support case preserving this query will seccessfully executed
and fetch data from 'fieldID' field of 'myTable' table.
Because of case insensetive next queries
select fieldid from mytable;
select FIELDID from MYTABLE;
will return same results as first one
you say that some utils extract quote object's names in resulting metadata.
so that some tool will generate next metadata:
create table "myTable" (
"fieldID" integer
);
When you execute that metadata as the result you will get
'myTable' table with 'fieldID' field.
As DB server is not case sensetive I can still query this table like next:
select fieldID from myTable;
select fieldid from mytable;
select FIELDID from MYTABLE;
If tool will extract some metadata from stored prcedure or trigeer it must leave their body AS IS
I mean if there is in body a query
BEGIN
....
select fieldID from myTable;
....
END
It must not quote 'fieldID' or 'myTable'. Is I right?
so body will be untouched in extracted metadata:
BEGIN
....
select fieldID from myTable;
....
END
Where may quoting still source of errors?
Suppose that you are supporting now case-preserving
create table myTable (
fieldID integer
);
This query will create table 'myTable' with field 'fieldID' in DB
somewhere in programm there will be next query:
select fieldID from myTable;
as FireBird is already support case preserving this query will seccessfully executed
and fetch data from 'fieldID' field of 'myTable' table.
Because of case insensetive next queries
select fieldid from mytable;
select FIELDID from MYTABLE;
will return same results as first one
you say that some utils extract quote object's names in resulting metadata.
so that some tool will generate next metadata:
create table "myTable" (
"fieldID" integer
);
When you execute that metadata as the result you will get
'myTable' table with 'fieldID' field.
As DB server is not case sensetive I can still query this table like next:
select fieldID from myTable;
select fieldid from mytable;
select FIELDID from MYTABLE;
If tool will extract some metadata from stored prcedure or trigeer it must leave their body AS IS
I mean if there is in body a query
BEGIN
....
select fieldID from myTable;
....
END
It must not quote 'fieldID' or 'myTable'. Is I right?
so body will be untouched in extracted metadata:
BEGIN
....
select fieldID from myTable;
....
END
Where may quoting still source of errors?
----- Original Message -----
From: Martijn Tonies
To: firebird-support@yahoogroups.com
Sent: Tuesday, December 04, 2007 7:20 PM
Subject: Re: [firebird-support] Upper case behaviour
> > the problem is not case sensetive or case insensetive
> > the problem is storing object name as UPPERCASE and not AS IS
> >
> > SOIGETUNREADABLENAMESWHILEMIGRATINGTOFIREBIRDFROMMYSQL
> >
>
> Don't get me started on case in MySQL. Table names in MySQL
> are case sensitive and case preserving on Linux and some
> Mac/OS file systems. They are case insensitive and not
> case preserving by default on Windows and other Mac/OS
> systems. There is an option to make those systems case
> preserving, but it doesn't work with the InnoDB storage
> engine.
:-)
> A practical problem for Firebird is that tools depend on
> the fact that they can always quote identifiers when constructing
> statements from the metadata. If we change to case-preserving,
> that will fail.
If the difference between case sensitive and case preserving is
stored in the metadata tables, those tools "just" need to support
this new feature.
For example, in Database Workbench I'm checking to see if
it's not all uppercase, if so -> quoted. If it has special characters ->
quoted, and so on.
If it's a simple name, all uppercase -> not quoted. Quite easy actually.
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
[Non-text portions of this message have been removed]