Re: Postgres provider to use gda-srv lib



On jeu, 06 jui 2000, you wrote:

> 
> > 3) the returned value from the function gda_mysql_connection_get_c_type() is
> > not well defined. So I propose that we define them as I did with Postgres
> > (Gda_POSTGRES_CType enumeration) once for everyone. I don't know exactly where
> > to put this.
> > 
> Perfect, how is it defined for the PostgreSQL provider?

I have defined an enum like:
typedef enum {
  SQL_C_DATE,
  SQL_C_TIME,
  SQL_C_TIMESTAMP,
  SQL_C_BINARY,
  SQL_C_BIT,
  SQL_C_TINYINT,
  SQL_C_CHAR,
  SQL_C_LONG,
  SQL_C_SHORT,
  SQL_C_FLOAT,
  SQL_C_DOUBLE,
  SQL_C_SLONG,
  SQL_C_SSHORT,
  SQL_C_ULONG,
  SQL_C_USHORT,
  SQL_C_STINYINT,
  SQL_C_UTINYINT,
  SQL_C_BOOKMARK
} POSTGRES_CType;

I have then a basic corresponding scheme that I got from the postgres ODBC:
GDA_TypeDbTimestamp, SQL_C_TIMESTAMP
GDA_TypeBoolean, SQL_C_BIT
GDA_TypeChar, SQL_C_CHAR
GDA_TypeDbDate, SQL_C_DATE
GDA_TypeSingle, SQL_C_FLOAT
GDA_TypeDouble, SQL_C_DOUBLE
GDA_TypeSmallint, SQL_C_SSHORT
GDA_TypeInteger, SQL_C_SLONG
GDA_TypeLongvarchar, SQL_C_CHAR
GDA_TypeVarchar, SQL_C_CHAR
GDA_TypeVarbin, SQL_C_BINARY
GDA_TypeDbTime, SQL_C_TIME

What I did for the postgres provider is for all the most common data types
(int, fload, bool, etc) I made a correspondance between the GDA type, Sql type
and C type. For all the other data types which are more exotic and user
defined ones, I return Varchar and SQL_C_CHAR (so returning Varchar when the
type is unknown is important here).

Tell me what you think.

Cheers,

Vivien




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