Re: Per-table meta-data with capital letters in the table

View: New views
12 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: Per-table meta-data with capital letters in the table

by Shawn Ferris :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> 1.
> You added a section about SQL Identifiers that mentions quotes:
>
> But I find this surprising, and I doubt that it's true:
> http://git.gnome.org/cgit/libgda/tree/doc/C/libgda-4.0-docs.sgml#n465
> "
> Many people consider that using the quoted syntax should be avoided if
> possible because:
> - once an SQL identifier has been defined using the quoted syntax, it
> must always be used quoted, which is error prone especially if  
> external
> tools are used on the database.
> "

Not that my opinion matters, but to add my $.02, I would absolutely  
agree with this.. Nothing makes me more crazy than a tool creating a  
table in oracle that is mixed case or using a reserved word.  I'm  
mostly a command line guy and having to quote for quote sake is a  
pain. I think it should follow suite to the rdms.. Sybase supports  
mixed case natively so qoutes aren't necessary and oracle isn't by  
default so its very awkward when introduced.

I think tools need to support the ability to do this, but not as  
default behavior.


_______________________________________________
gnome-db-list mailing list
gnome-db-list@...
http://mail.gnome.org/mailman/listinfo/gnome-db-list

Re: Per-table meta-data with capital letters in the table

by Murray Cumming :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2009-07-14 at 21:35 -0600, Shawn Ferris wrote:

> Not that my opinion matters, but to add my $.02, I would absolutely  
> agree with this.. Nothing makes me more crazy than a tool creating a  
> table in oracle that is mixed case or using a reserved word.  I'm  
> mostly a command line guy and having to quote for quote sake is a  
> pain. I think it should follow suite to the rdms.. Sybase supports  
> mixed case natively so qoutes aren't necessary and oracle isn't by  
> default so its very awkward when introduced.
>
> I think tools need to support the ability to do this, but not as  
> default behavior.

Glom is for users who don't care about SQL. Also, users of raw SQL will
rarely want to use Glom's databases. I could prevent the user from using
uppercase and spaces in table names but it would just seem arbitrary and
unnecessarily techy, like requiring 8-character filenames.

If quotes really mean "I really mean this" (as I believe) then I would
expect well-written SQL to use them always, particularly if that SQL is
generated.

libgda generates SQL so it shouldn't require me to add quotes myself.

--
murrayc@...
www.murrayc.com
www.openismus.com

_______________________________________________
gnome-db-list mailing list
gnome-db-list@...
http://mail.gnome.org/mailman/listinfo/gnome-db-list

Re: Per-table meta-data with capital letters in the table

by Vivien Malerba :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



2009/7/17 Murray Cumming <murrayc@...>
On Tue, 2009-07-14 at 21:35 -0600, Shawn Ferris wrote:
> Not that my opinion matters, but to add my $.02, I would absolutely
> agree with this.. Nothing makes me more crazy than a tool creating a
> table in oracle that is mixed case or using a reserved word.  I'm
> mostly a command line guy and having to quote for quote sake is a
> pain. I think it should follow suite to the rdms.. Sybase supports
> mixed case natively so qoutes aren't necessary and oracle isn't by
> default so its very awkward when introduced.
>
> I think tools need to support the ability to do this, but not as
> default behavior.

Glom is for users who don't care about SQL. Also, users of raw SQL will
rarely want to use Glom's databases. I could prevent the user from using
uppercase and spaces in table names but it would just seem arbitrary and
unnecessarily techy, like requiring 8-character filenames.

If quotes really mean "I really mean this" (as I believe) then I would
expect well-written SQL to use them always, particularly if that SQL is
generated.

libgda generates SQL so it shouldn't require me to add quotes myself.

The new gda_sql_identifier_quote() function  does exaclty this for you: make sure you pass TRUE as the last argument.

Vivien



_______________________________________________
gnome-db-list mailing list
gnome-db-list@...
http://mail.gnome.org/mailman/listinfo/gnome-db-list

Re: Per-table meta-data with capital letters in the table

by Murray Cumming :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2009-07-17 at 14:10 +0200, Vivien Malerba wrote:
> The new gda_sql_identifier_quote() function  does exaclty this for
> you: make sure you pass TRUE as the last argument.

Must we use this for the table name and field name parameters when using
GDA_SERVER_OPERATION_ADD_COLUMN and similar commands with
GdaServerOperation?
http://library.gnome.org/devel/libgda/unstable/ch18.html#id3131073

I hope not.

--
murrayc@...
www.murrayc.com
www.openismus.com

_______________________________________________
gnome-db-list mailing list
gnome-db-list@...
http://mail.gnome.org/mailman/listinfo/gnome-db-list

Re: Per-table meta-data with capital letters in the table

by Vivien Malerba :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



2009/7/19 Murray Cumming <murrayc@...>
On Fri, 2009-07-17 at 14:10 +0200, Vivien Malerba wrote:
> The new gda_sql_identifier_quote() function  does exaclty this for
> you: make sure you pass TRUE as the last argument.

Must we use this for the table name and field name parameters when using
GDA_SERVER_OPERATION_ADD_COLUMN and similar commands with
GdaServerOperation?
http://library.gnome.org/devel/libgda/unstable/ch18.html#id3131073

When database providers render a GdaServerOperation to SQL when performing the operation, the SQL identifiers are copied without any transformation, so it's up to you to correctly set the SQL identifiers values (such as table name), so the anwser is no, you don't have to.
 
Vivien



_______________________________________________
gnome-db-list mailing list
gnome-db-list@...
http://mail.gnome.org/mailman/listinfo/gnome-db-list

Re: Per-table meta-data with capital letters in the table

by Murray Cumming :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, 2009-07-19 at 11:38 +0200, Vivien Malerba wrote:

>
>
> 2009/7/19 Murray Cumming <murrayc@...>
>         On Fri, 2009-07-17 at 14:10 +0200, Vivien Malerba wrote:
>         > The new gda_sql_identifier_quote() function  does exaclty
>         this for
>         > you: make sure you pass TRUE as the last argument.
>        
>        
>         Must we use this for the table name and field name parameters
>         when using
>         GDA_SERVER_OPERATION_ADD_COLUMN and similar commands with
>         GdaServerOperation?
>         http://library.gnome.org/devel/libgda/unstable/ch18.html#id3131073
>
> When database providers render a GdaServerOperation to SQL when
> performing the operation, the SQL identifiers are copied without any
> transformation, so it's up to you to correctly set the SQL identifiers
> values (such as table name), so the anwser is no, you don't have to.

Thanks. Unfortunately that's not yet working with PostgreSQL, though it
works with SQLite:
http://bugzilla.gnome.org/show_bug.cgi?id=589102

--
murrayc@...
www.murrayc.com
www.openismus.com

_______________________________________________
gnome-db-list mailing list
gnome-db-list@...
http://mail.gnome.org/mailman/listinfo/gnome-db-list

Re: Per-table meta-data with capital letters in the table

by Murray Cumming :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2009-07-17 at 14:10 +0200, Vivien Malerba wrote:
> The new gda_sql_identifier_quote() function  does exaclty this for
> you: make
> sure you pass TRUE as the last argument.

As I've said elsewhere, I hate that this function is necessary to just
tell libgda to do what I say, because you feel the need to make libgda
as weird as SQL, but if it must exist, would you consider adding these
convenience functions?
  gda_meta_store_quote(const char*)
and
  gda_server_provider_quote(provider, const char*)

Right now this is a really ugly function that will litter Glom's code
with obscure parameters:
http://murrayc.com/temp/libgda_docs/html/GdaSqlParser.html#gda-sql-identifier-quote

And should you deprecate the (now ambiguous)
gda_sql_identifier_remove/add/needs/_quotes() functions because they
don't mention whether the "meta-store convention" should apply?

--
murrayc@...
www.murrayc.com
www.openismus.com

_______________________________________________
gnome-db-list mailing list
gnome-db-list@...
http://mail.gnome.org/mailman/listinfo/gnome-db-list

Re: Per-table meta-data with capital letters in the table

by Johannes Schmid-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

>
> When database providers render a GdaServerOperation to SQL when
> performing the operation, the SQL identifiers are copied without any
> transformation, so it's up to you to correctly set the SQL identifiers
> values (such as table name), so the anwser is no, you don't have to.

Wouldn't it be useful if GdaSqlBuilder would automatically check if the
SQL identifiers need quoting and quote them if needed? As I programmer I
would expect that it takes care of it as it takes care for quoting SQL
keywords.

Thanks,
Johannes



_______________________________________________
gnome-db-list mailing list
gnome-db-list@...
http://mail.gnome.org/mailman/listinfo/gnome-db-list

signature.asc (204 bytes) Download Attachment

Re: Per-table meta-data with capital letters in the table

by Vivien Malerba :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/10/4 Johannes Schmid <jhs@...>:

> Hi!
>
>>
>> When database providers render a GdaServerOperation to SQL when
>> performing the operation, the SQL identifiers are copied without any
>> transformation, so it's up to you to correctly set the SQL identifiers
>> values (such as table name), so the anwser is no, you don't have to.
>
> Wouldn't it be useful if GdaSqlBuilder would automatically check if the
> SQL identifiers need quoting and quote them if needed? As I programmer I
> would expect that it takes care of it as it takes care for quoting SQL
> keywords.

Id does when you use gda_sql_builder_add_id(), see for example
http://git.gnome.org/cgit/libgda/tree/samples/SqlBuilder/example.c.

Vivien
_______________________________________________
gnome-db-list mailing list
gnome-db-list@...
http://mail.gnome.org/mailman/listinfo/gnome-db-list

Re: Per-table meta-data with capital letters in the table

by Johannes Schmid-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

> Id does when you use gda_sql_builder_add_id(), see for example
> http://git.gnome.org/cgit/libgda/tree/samples/SqlBuilder/example.c.

But it doesn't for set_table() for example. At least when I tried it
didn't quote a capital table name.

Regards,
Johannes


_______________________________________________
gnome-db-list mailing list
gnome-db-list@...
http://mail.gnome.org/mailman/listinfo/gnome-db-list

signature.asc (204 bytes) Download Attachment

Re: Per-table meta-data with capital letters in the table

by Vivien Malerba :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/10/5 Johannes Schmid <jhs@...>:
> Hi!
>
>> Id does when you use gda_sql_builder_add_id(), see for example
>> http://git.gnome.org/cgit/libgda/tree/samples/SqlBuilder/example.c.
>
> But it doesn't for set_table() for example. At least when I tried it
> didn't quote a capital table name.

It does for me, see the attached file with the README to show the results I get.

Can you send me a non-working example?

Vivien


_______________________________________________
gnome-db-list mailing list
gnome-db-list@...
http://mail.gnome.org/mailman/listinfo/gnome-db-list

SqlBuilder.tbz (3K) Download Attachment

Re: Per-table meta-data with capital letters in the table

by Johannes Schmid-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

> It does for me, see the attached file with the README to show the results I get.
>
> Can you send me a non-working example?

Sorry, I wasn't aware that it is a difference if I use a Connection or
not for the resulting SQL. I guess it's fine than.

Thanks,
Johannes


_______________________________________________
gnome-db-list mailing list
gnome-db-list@...
http://mail.gnome.org/mailman/listinfo/gnome-db-list

signature.asc (204 bytes) Download Attachment