Re: Insert with bound columns

From: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
To: Andreas Pflug <Andreas(dot)Pflug(at)web(dot)de>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: Insert with bound columns
Date: 2003-02-07 04:17:44
Message-ID: 3E433368.FCE7D528@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Andreas Pflug wrote:
>
> After experimenting heavily, I found out some more.
> MSDASQL doesn't like a NULL-pointer as string in the buffer to be
> written. Instead, a SysAllocString(L"") is needed. This is acceptable,
> if an zero length string should be inserted. If the status field of the
> buffer ist not set to DBSTATUS_S_OK indicating valid data to be written,
> but to DBSTATUS_S_ISNULL for a NULL to be inserted, MSDASQL will fail
> with "Parameter type cannot be determined for at leas one variant
> parameter". Actually, it's no variant given, but a DBTYPE_BSTR, and this
> information is put correctly into the DBBINDING structure. Still, I
> believe ADO users should be unable to insert a NULL string into a
> VARCHAR column (if not omitted in the query).

I can insert a '' or NULL using ADO.Parameter in VB.

> The same (OLEDB side) code works with SQLSRV32, and MSDASQL blows as
> soon as it gets to know the number of parameters, so it seems that for
> SQLSRV32 MSDASQL can determine the parameter type from the SQL server
> driver, but not with PostgreSQL.

The psqlodbc driver couldn't determine the parameter type
unless the upper application specifies it explicitly.

> Does this switch on a light for
> anybody, saying "ah now I know what SQLxxyy is for"? If pointed towards
> some topic, I could try to implement it.

Maybe SQLDescribeParam should be supported though I'm
not sure.

regards,
Hiroshi Inoue
http://www.geocities.jp/inocchichichi/psqlodbc/

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Tambet Matiisen 2003-02-07 08:46:26 Re: Cannot insert into view without an appropriate rule (#7)
Previous Message Andreas Pflug 2003-02-06 21:56:51 Re: Insert with bound columns