Re: [gnome-db] libgda escape_value() and schema retreival
- From: Rodrigo Moya <rodrigo gnome-db org>
- To: Alan Knowles <alan akbkhome com>
- Cc: GDA <gnome-db-list gnome org>, Murray Cumming <murrayc murrayc com>
- Subject: Re: [gnome-db] libgda escape_value() and schema retreival
- Date: Sat, 25 Sep 2004 14:08:05 +0200
On Tue, 2004-08-17 at 23:34 +0800, Alan Knowles wrote:
> Rodrigo- , thanks for looking at it/ addressing it.
>
> Murray Cumming wrote:
>
> >This seems to add a function like this:
> >
> >gboolean
> >gda_connection_escape_string (GdaConnection *cnc,
> > gchar *from,
> > const gchar *to,
> > unsigned long length)
> >
> >So,
> >
> >
>
> >1. Why do we need to provide the length of the "from" string? Surely, all
> >strings in libgda are null-terminated?
> >
> >
> Sorry dont know libgda that well to comment..
>
> >2. It seems to convert from "to" to "from". Isn't that a bit backwards?
> >
> >
> Actually, it was a pretty straight copy from the original mysql_/pgsql_
> functions that did the same thing. - the only justification for keeping
> that standard was probably that anyone who's familar with the API's
> would pick up libgda a minute bit faster..
>
> >3. Is this just for creating SQL-representations of text values? Surely
> >it's more useful to have a funciton to create a SQL representation of a
> >GValue, whatever type that GValue has.
> >
> >
> I agree, That would be better, In reality though, it's only strings
> AFAIK that need escaping, and may be locale specific on the database
> (eg. BIG5 in a mysql db, has to watch out what it quotes..) so if it was
> implemented as a Gda_connection_value_to_Sql(Gda_connection,
> Gda_value,gchar) - only when the gda_value was a string, would the
> function be called.
>
> >4. Does this add the quotes, or do you need a big switch/case (switching
> >on the field type) block in the app for that?
> >
> >
> actually, only a few types varchar/char/text need escaping (which are
> represented as a single type in gda? AFAIK), so it's not that huge a
> switch/case.
>
well, if we have the escape_value, apps would use it to generate the SQL
strings, so they would be calling the escape_value function for each
value they want to convert, so yeah, I guess we'll need a huge
switch/case in each provider's implementation of the escape_value
method.
--
Rodrigo Moya <rodrigo gnome-db org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]