Re: Data types mapping



Vivien Malerba wrote:

> Hi all!
>
> I'm busy at the moment trying to map the postgres data types to the GDA ones
> (for the postgres provider). In fill_field_values(), for each field, I now set
> the field->value->_d and the field->value->_u.
>
> But in the client, for each field, the returned type is GDA_TypeVarchar,
> regardless of what the GDA type given in the provider part is (and so the
> client tries to access a GDA_TypeVarchar when it really is for example an int,
> and crashes!)
>
> It appears as though the problem comes from the CORBA interface...
>
> Any idea of how to solve it?
>

Yes, replace the line (in gda-postgres.c - GDA_Recordset_describe() function):

field->gdaType     = GDA_TypeVarchar;

with

field->gdaType = gda_postgres_sql2gdatype(server_field->sql_type);

Replace the name of the function with the one you did, and be sure to always fill
in the GDA_Value union values depending on the datatype. To see an example, look
at the gda-odbc-server/gda-recset.c file (the function
gda_odbc_recset_allocmem())

All this CORBA stuff will be removed from each server as soon as the server
building framework works perfectly. But for the moment, each provider must
contain all this.

>
> Cheers

Cheers!



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