Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 13E53475B8C for ; Fri, 15 Nov 2002 18:37:02 -0500 (EST) Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by postgresql.org (Postfix) with SMTP id 552F74758C9 for ; Fri, 15 Nov 2002 18:37:00 -0500 (EST) Received: (qmail 2878 invoked from network); 15 Nov 2002 23:37:01 -0000 Received: from unknown (HELO viscomail.tpf.co.jp) (100.0.0.108) by sd2.tpf-fw-c.co.jp with SMTP; 15 Nov 2002 23:37:01 -0000 Received: from tpf.co.jp (3dgateway1 [126.0.1.60]) by viscomail.tpf.co.jp (8.8.8+Sun/8.8.8) with ESMTP id IAA29013; Sat, 16 Nov 2002 08:36:52 +0900 (JST) Message-ID: <3DD5856B.75BC5788@tpf.co.jp> Date: Sat, 16 Nov 2002 08:38:19 +0900 From: Hiroshi Inoue X-Mailer: Mozilla 4.73 [ja] (Windows NT 5.0; U) X-Accept-Language: ja MIME-Version: 1.0 To: =?iso-2022-jp?B?Qm8bJEIlPRsoQmVuYQ==?= Potempa Cc: pgsql-odbc@postgresql.org Subject: Re: PostgreSQL+ Beta bug? References: Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/71 X-Sequence-Number: 2248 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/