Re: [gnome-db] Data Types translations.



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

 On Wed, 2006-08-30 at 20:44 +1000, Bas Driessen wrote:

 Hi Vivien,

 Still struggling with the gda_type to provider data type issue....

 There is this new function:

 const gchar* gda_server_provider_get_default_dbms_type
(GdaServerProvider *provider,
 GdaConnection *cnc,
                                             GType
gda_type);


 Just looked into it, but for mysql and postgresql it is useless, since it
always returns NULL. For the mysql provider there is a file called
"utils.c". In there is a function called gda_mysql_type_from_gda(). This is
basically the translation table where I want to have access to. There is a
also a utils.c for postgres, but appears to be setup differently, but
assumes it works similar. How would this all come together?

 I just want to be able to put in a G_TYPE_STRING as an argument in some
function and get a provider dependent value back like "varchar" for mysql so
I can use this in the new method of building a table.



 Ah I see. Is it OK if I add in a function like this in
gda-postgres-provider.c:

 static const gchar
*gda_postgres_provider_get_def_dbms_type (GdaServerProvider
*provider,


  GdaConnection *cnc,

  GType gda_type)
 {
         g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), FALSE);
         g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);


         return postgres_name_from_gda_type (gda_type);
 }

 (and matching declarations etc.) Tested locally and that appears to do the
trick. This makes
gda_server_provider_get_default_dbms_type() work for
postgresql.

 Bas.

Please check the latest CVS version where I've implemented those
functions for MySQL, PostgreSQL and SQLite (I realized they were not
implemented after I told you to use them!)

Cheers,

vivien



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