From: | Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp> |
---|---|
To: | Boソena Potempa <Bozena(dot)Potempa(at)otc(dot)pl> |
Cc: | pgsql-odbc(at)postgresql(dot)org |
Subject: | Re: PostgreSQL+ Beta bug? |
Date: | 2002-11-15 23:38:19 |
Message-ID: | 3DD5856B.75BC5788@tpf.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
Boソena Potempa wrote:
>
> Dear Authors of PostgreSQL ODBC driver,
>
> I am trying to use PostgreSQL+ Beta driver on Windows 2000.
> It works very well with one exception. When I try to
> insert a char value including 0 then the remaing characters
> are lost. And example:
>
> simple table: create table t (fc varchar(5))
>
> The program code (runable in MS VC++ 6.0):
> // connect and allocate a statement handle hstmt
> HSTMT hstmt;
> RETCODE rc;
> char fc[5];
> SQLINTEGER fcl;
>
> rc = SQLPrepare(hstmt, "insert into t values(?)", SQL_NTS);
> rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR,
> SQL_VARCHAR, 5, 0, fc, sizeof(fc), &fcl);
> fc[0]=1;
> fc[1]=0;
> fc[2]='a';
> fcl=3; /* string length */
> rc = SQLExecute(hstmt);
> // disconnect
> -----
>
> After this please check in psql:
> select ascii(substring(fc,1,1)) from t; - 1, OK
> select ascii(substring(fc,2,1)) from t; - 0, OK
> select ascii(substring(fc,3,1)) from t; - 0 - lost value 'a'
>
> Please let me know if this is a known bug and what is the possibility
> of fixing this.
As long as you are using text(char or varchar) type, you can't
store strings other than null terminated ones.
Please use BYTEA type instead and bind the parameter using
SQL_C_BINARY and SQL_VARBINARY.
regards,
Hiroshi Inoue
http://w2422.nsk.ne.jp/~inoue/
From | Date | Subject | |
---|---|---|---|
Next Message | Hiroshi Inoue | 2002-11-16 03:43:51 | Re: Threading crash using ODBC |
Previous Message | Jason Tishler | 2002-11-15 19:57:38 | Re: [ODBC] ODBC Unix distro building woes |