Re: Money type mapping to backend (MORE)

From: Byron Nikolaidis <byronn(at)insightdist(dot)com>
To: bill(at)hammondgroves(dot)com
Cc: "pgsql-interfaces(at)hub(dot)org" <pgsql-interfaces(at)hub(dot)org>, "Ken J(dot) Wright" <ken(at)ori-ind(dot)com>, "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
Subject: Re: Money type mapping to backend (MORE)
Date: 1999-01-08 16:07:56
Message-ID: 36962D5B.5D4FBAA2@insightdist.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-interfaces by date

  From Date Subject
Next Message Thomas G. Lockhart 1999-01-08 16:25:29 Re: Money type mapping to backend
Previous Message Stefan Hornburg 1999-01-08 16:00:07 Re: Problems building libpgtcl