Re: [gnome-db] Data Types translations.



On 8/30/06, Bas Driessen <bas driessen xobas com> wrote:
[...]

 Another small issue to fix is to put characters around the column names.
For postgresql for instance the following will fail:

 CREATE TABLE Test (Id int4 NOT NULL, Desc varchar(10), Price numeric(5,2))

 Reason is that 'Desc' is a reserved name. In case of Postgresql it should
be surrounded with double quote ("). In case of Mysql it is the back quote
(`) I believe. Just a small change in the *-dll.c file for the various
providers. Tested locally here and works OK. Let me know if you want me to
change this in CVS or if you will do it.

Please send me a patch and I'll commit that myself.


 Further to the discussion regarding the creation of the table. There is the
Path: /FIELDS_A/@COLUMN_TYPE. Here a complete type must be set. For
postgresql that is varchar(30) for instance. As mentioned before I would
like to see this part more provider independent. Perhaps we can reach some
sort of a compromise. First I tell you what I would like to see:

 /FIELDS_A/@COLUMN_GTYPE
 /FIELDS_A/@COLUMN_SIZE
 /FIELDS_A/@COLUMN_SCALE

 example values:
 GDA_TYPE_NUMERIC
 10
 2

 This then will be translated by the postgresql provider for instance to
numeric(10,2).

 To provide both options to the user, we can say that if
/FIELDS_A/@COLUMN_TYPE (the current situation), this overrules any
situation. If it is not set, the user should set

 /FIELDS_A/@COLUMN_GTYPE
 /FIELDS_A/@COLUMN_SIZE  (if applicable)
 /FIELDS_A/@COLUMN_SCALE (if applicable)

 Then for the various providers we can make this into something that works
for the data provider.


I agree on having the /FIELDS_A/@COLUMN_SIZE and
/FIELDS_A/@COLUMN_SCALE as this makes things more provider
independant.

However I prefer to stay with a /FIELDS_A/@COLUMN_TYPE because it's
closer to what a user can easily fill-in and it's easy for a
programmer (using gda_server_provider_get_default_dbms_type()) to
convert from a GType to a DBMS type. It also makes it possible to
check and take actions when the provider doesn't support a particular
GType before trying to execute the action.

So I propose to have
/FIELDS_A/@COLUMN_TYPE (required)
/FIELDS_A/@COLUMN_SIZE (optional)
/FIELDS_A/@COLUMN_SCALE (optional)

Is it Ok for you? If so, can you make the modifications in the xml.in
files and in the -ddl.c files for some or all of the providers?

Cheers,

Vivien



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