Re: [gnome-db] gda_value_stringify() and sql-format strings



> These issues might be connected, so I'll mention them in the same email:
>
> 1. The docs for gda_value_stringify() say "Returns : a string formatted
> according to the printf() style indicated in the preceding table.". But
> there is no "preceding table" in the docs, and no format string in the
> list of arguments. gda_value_stringify() seems to return a text
> representation based on the locale, so it is useful for displaying the
> text, but not useful for putting in a SQL statement.

Right, it returns a "human readable" string.

>
> 2. Maybe we should have a gda_value_to_sql_string() functin which would
> return the text representation of the value as needed by SQL statements.
> It would
> 2.1 Add quotes if necessary - for instance, around text, dates, times,
> etc, but not around numbers.
> 2.2 Escape special characters, such as quotes.
> 2.3 Format numbers, dates, and times according to the C locale, ISO-
> standard, or whatever SQL needs.

I have already done this kind of function for libmergeant, but it's not
localized in one single file (in fact there is on file for each kind of
data (strings, dates, numbers, etc). Anyway, having a libgda function for
this would be good.

Note that for dates, Libmergeant always formats SQL dates as MM-DD-YYY as
it's up to the provider to make sure the DBMS is set up in such a way as
to accept that date format.

Cheers,

Vivien






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]