Re: Money type mapping to backend (MORE) - Mailing list pgsql-interfaces

From Byron Nikolaidis
Subject Re: Money type mapping to backend (MORE)
Date
Msg-id 36962D5B.5D4FBAA2@insightdist.com
Whole thread Raw
List pgsql-interfaces

Bill Hutto wrote:

> > Please send the "psqlodbc.log" file of the session.  This will show the sql statement
> > as sent to the backend and prove once and for all what the error is.  It is hard to
> > make a diagnosis without knowing what really is going wrong.
>
> OK Byron, I've attached the session using data bound controls from
> Visual Basic.
>
> Table Name: visdata
>
> Fields:
>         field1  char(40)
>         amount  money
>         quantity        int8
>

The problem with trying to put quotes around the "amount" field is that on the odbc side, I have no
idea that it is indeed a money type.  Since there is no SQL_MONEY type, I have no way of knowing that
the destination is a PG_MONEY type.  And since we don't have a real prepared statement with
parameters, I can't ask the backend to tell me what the parameter data type is.

But there might be a workaround.  The driver will quote character type parameters.  Can you somehow
tell vb/ado that the field needs to be a character field?  Ultimately what we want is the following
odbc call:

SQLBindParamter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_FLOAT, SQL_VARCHAR, ...)

See that 5th argument, that would tell the driver to convert the input data from a float to a
character before sending it to the backend, which would result in quotes around it.  You could also
use SQL_CHAR there.

Byron




pgsql-interfaces by date:

Previous
From: JP Rosevear
Date:
Subject: Kaffe 1.0b3 Solved yet?
Next
From: Stefan Hornburg
Date:
Subject: Re: Problems building libpgtcl