pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Campbell <greg.campbell@us.michelin.com>
To: Ed Brown <ebrown@arcompanies.net>
Cc: pgsql-odbc@postgresql.org
Subject: Re: SQL Error- SQLBindColumn and TimeStamp Field
Date: Wed, 17 Nov 2004 15:17:49 -0500
Message-ID: <419BB1ED.7050000@us.michelin.com> (raw)
In-Reply-To: <07d901c4ccd8$254b2360$fb04a8c0@arcHead.arcompanies.net>
References: <07d901c4ccd8$254b2360$fb04a8c0@arcHead.arcompanies.net>

Please clarify "trying to insert a Timestamp field"
Are you doing Data Definition -- creating a timestamp field
or
Data Manipulation -- populating data into an existing timestamp field.

If data manipulation:
I do not know Delphi, but couldn't you execute as query string against a 
connection -- a string like
"INSERT INTO my_table (my_time) VALUES ('2004-11-17 12:10:35')"?

and did you mean for the year value to be 200?



Ed Brown wrote:

> I have been trying to do an insert into a TimeStamp field in 
> Postgresql 7.34 (running on Suse 9.0, if it matters).  The application 
> is in Delphi 7.0, but the code is similar enough that you C gurus 
> should be able to see what's happening.  I get the text as a string, 
> parse it into the various elements, and populate the 
> SQL_TimeStamp_Structure. When I execute the SQLBindColumn function I 
> get the following message:
>  
>     Unable to Bind Parameter- State: S1003, Error # 0, 
> [Microsoft][ODBC Driver Manager] Program type out of range
>  
> The values in the structure are reasonable, and other elements work 
> properly. Can anyone either tell me what I'm doing wrong, or show me 
> an example of setting a Timestamp value that works?
>  
> Thanks very much. Code Follows
>  
> Ed Brown
> ------------------------------------------------------------------------
>  
>  New(pTimeStamp);
>  DecodeDate(dtThis, i1,i2,i3);
>  pTimeStamp^.year := i1;
>  pTimeStamp^.Month := i2;
>  pTimeStamp^.Day := i3;
>  DecodeTime(dtThis, i1,i2,i3,i4);
>  pTimeStamp^.Hour := i1;
>  pTimeStamp^.minute := i2;
>  pTimeStamp^.second := i3;
>  pTimeStamp^.fraction := i4;
>  
>  New(piTemp);
>  lIntegers.Add(piTemp);
>  
> // Fails on next call
>  retcode := SQLBindParameter(hSTMT, i + 1, SQL_PARAM_INPUT,
>   SQL_C_TYPE_TIMESTAMP,
>   SQL_TYPE_TIMESTAMP,
>   SizeOf(SQL_TIMESTAMP_STRUCT), 0 ,
>   pTimeStamp,
>   SizeOf(SQL_TIMESTAMP_STRUCT), piTemp) ;
> ------------------------------------------------------------------------
> The values are:
>  
>     pTimeStamp^.year = 200   
>     pTimeStamp^.Month =  7
>     pTimeStamp^.Day = 15
>     pTimeStamp^.Hour := 11
>     pTimeStamp^.minute := 15
>     pTimeStamp^.second := 0
>     pTimeStamp^.fraction := 0
>  

Attachments:

greg.campbell.vcf (text/x-vcard, 281B) download begin:vcard fn:Greg Campbell n:Campbell;Greg org:Michelin North America;ENG-IT adr;dom:;;2420 Two Notch Road;Lexington;SC;29071 email;internet:greg.campbell@us.michelin.com title:Systems Engineer tel;work:803-951-5561 tel;fax:803-951-5531 x-mozilla-html:FALSE version:2.1 end:vcard

view thread (4+ messages)  latest in thread

Message-ID: <419BB1ED.7050000@us.michelin.com>
Permalink:  ../419BB1ED.7050000@us.michelin.com/
Also on:    postgresql.org/message-id/419BB1ED.7050000@us.michelin.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: greg.campbell@us.michelin.com, ebrown@arcompanies.net
  Subject: Re: SQL Error- SQLBindColumn and TimeStamp Field
  In-Reply-To: <419BB1ED.7050000@us.michelin.com>
  References: <07d901c4ccd8$254b2360$fb04a8c0@arcHead.arcompanies.net> <419BB1ED.7050000@us.michelin.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