pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hiroshi Inoue <Inoue@tpf.co.jp>
To: Scot Loach <sloach@SANDVINE.com>
Cc: 'pgsql-odbc@postgresql.org' <pgsql-odbc@postgresql.org>
Subject: Re: 64-bit type in SQLBindParameter
Date: Fri, 25 Oct 2002 08:42:11 +0900
Message-ID: <3DB88553.BF2B903B@tpf.co.jp> (raw)
References: <FE045D4D9F7AED4CBFF1B3B813C85337E5F2DA@mail.sandvine.com>

Scot Loach wrote:
> 
> Is it possible to use 64-bit types for bound queries?
> 
> Here's my setup:
> FreeBSD 4.7
> UnixODBC 2.2.0
> PostgreSQL 7.2.1
> PostgreSQL/UnixODBC driver 7.2.1
> 
> I'm using the BIGINT type for my column.
> The program below prints out the error message:
> 
> [unixODBC]Error while executing the query;
> ERROR:  parser: parse error at or near ")"
> 
> It works if I change the SQL_BIGINT to SQL_INTEGER, but
> it only uses 32 bits of the number in that case.
> 
> #include <stdio.h>
> #include <sql.h>
> #include <sqlext.h>
> 
> main()
> {
>     SQLHENV     env;
>     SQLHDBC     dbc;
>     SQLINTEGER  val = 0;
>     unsigned long long ll = 6000000000;
> 
>     SQLAllocEnv(&env);
>     SQLAllocConnect(env, &dbc);
>     SQLConnect(dbc, (SQLCHAR*)"my_db", SQL_NTS, (SQLCHAR*)0, 0, (SQLCHAR*)0,
> 0);
>     SQLCHAR sql[] = "INSERT INTO my_table (my_column) VALUES (?)";
> 
>     HSTMT hstmt;
>     SQLAllocStmt(dbc, &hstmt);
>     SQLPrepare(hstmt, sql, SQL_NTS);
>     SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_DEFAULT, SQL_BIGINT,
> 0, 0, &ll, 0, &val);

SQL_C_DEFAULT for SQL_BIGINT is SQL_C_CHAR.
You can't specify SQL_C_SBIGINT(UBIGINT) for the C Data Type
under the driver.

regards,
Hiroshi Inoue
	http://w2422.nsk.ne.jp/~inoue/



view thread (3+ messages)  latest in thread

Message-ID: <3DB88553.BF2B903B@tpf.co.jp>
Permalink:  ../3DB88553.BF2B903B@tpf.co.jp/
Also on:    postgresql.org/message-id/3DB88553.BF2B903B@tpf.co.jp

 · 

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: Inoue@tpf.co.jp, sloach@SANDVINE.com
  Subject: Re: 64-bit type in SQLBindParameter
  In-Reply-To: <3DB88553.BF2B903B@tpf.co.jp>
  References: <FE045D4D9F7AED4CBFF1B3B813C85337E5F2DA@mail.sandvine.com> <3DB88553.BF2B903B@tpf.co.jp>

* 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