Problem about Bytea and SQL_C_CHAR

From: "Han" <zhouhanok(at)vip(dot)sina(dot)com>
To: pgsql-odbc(at)postgresql(dot)org <pgsql-odbc(at)postgresql(dot)org>
Subject: Problem about Bytea and SQL_C_CHAR
Date: 2002-11-27 06:19:37
Message-ID: 20021127061918.756184760EF@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hi,
Here is the code:

strcpy(data, "FF");
cb = 2;
rc = SQLBindParameter(hstmt, i,
SQL_PARAM_INPUT,
SQL_C_CHAR, SQL_VARBINARY,
precision, scale,
&data, MAX_STRING_SIZE,
&cb);
rc = SQLPrepare(hstmt, "insert into test(ColBytea) values(?)", SQL_NTS);
rc = SQLExecute(hstmt);

After this, the value inserted in column ColByteatable(datatype is bytea) of table test was a char string 'FF', which was expected to be 0xFF(255).

There's no problem with binary column in Ms Sql Server. I'm porting my code from sql server to postgresql. So help me, please!

Regards!

        

        Han
        zhouhanok(at)vip(dot)sina(dot)com
          2002-11-27

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Hiroshi Inoue 2002-11-27 09:43:36 ODBC changes
Previous Message Tom Lane 2002-11-27 01:44:59 Re: inserting blob data