pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Byron Nikolaidis <byronn@insightdist.com>
To: bill@hammondgroves.com
Cc: pgsql-interfaces@hub.org <pgsql-interfaces@hub.org>
Cc: Ken J. Wright <ken@ori-ind.com>
Cc: Thomas G. Lockhart <lockhart@alumni.caltech.edu>
Subject: Re: Money type mapping to backend (MORE)
Date: Fri, 08 Jan 1999 11:07:56 -0500
Message-ID: <36962D5B.5D4FBAA2@insightdist.com> (raw)
References: <199901081135.GAB79140@osage.gate.net>



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






Message-ID: <36962D5B.5D4FBAA2@insightdist.com>
Permalink:  ../36962D5B.5D4FBAA2@insightdist.com/
Also on:    postgresql.org/message-id/36962D5B.5D4FBAA2@insightdist.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: byronn@insightdist.com, bill@hammondgroves.com, pgsql-interfaces@hub.org, ken@ori-ind.com, lockhart@alumni.caltech.edu
  Subject: Re: Money type mapping to backend (MORE)
  In-Reply-To: <36962D5B.5D4FBAA2@insightdist.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox