Re: SQLBulkOperations

From: "John C(dot) Frickson" <john(at)frickson(dot)us>
To: "Inoue, Hiroshi" <inoue(at)tpf(dot)co(dot)jp>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL ODBC List <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: SQLBulkOperations
Date: 2014-06-06 12:55:06
Message-ID: 1402059306.8234.34.camel@server.frickson.pvt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

/etc/unixODBC/odbcinst.ini:
[PSQL]
Description = PostgreSQL
Driver64 = /usr/lib64/psqlodbcw.so
UsageCount = 1

I set attributes like this:

SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0);
SQLSetConnectAttr(hdbc,SQL_ATTR_ODBC_CURSORS,(SQLPOINTER)SQL_CUR_USE_ODBC,0);
SQLSetStmtAttr(hstmt,SQL_ATTR_CONCURRENCY, SQL_CONCUR_ROWVER, 0);
SQLSetStmtAttr(hstmt,SQL_ATTR_CURSOR_TYPE,SQL_CURSOR_KEYSET_DRIVEN,0);

Connection is DSN-less using connection string:
DRIVER={PGSQL};SERVER=xx.xxx.xx.x;UID=user;PWD=pass;DATABASE=MyDB;UseServerSidePrepare=1;

I'm doing a read on a record and binding the columns. If found, update
some columns and call
SQLSetPos(hstmt, 1, SQL_UPDATE, SQL_LOCK_NO_CHANGE)
to do the update, which works fine.

If the record is not found, I set the values of all bound columns,
then call
SQLBulkOperations(hstmt, SQL_ADD)
at which point I get the error.

The SQLSetPos for update had been failing until I changed the
concurrency to SQL_CONCUR_ROWVER and type to SQL_CURSOR_KEYSET_DRIVEN.

I'm not sure what you mean about setting "option=1"??

On Fri, 2014-06-06 at 21:13 +0900, Inoue, Hiroshi wrote:
> How are you setting UpdatableCursors option?
> You have to set the option=1 when you use SQLBulkOperations().
>
> regards,
> Hiroshi Inoue
>
> (2014/06/06 20:57), John C. Frickson wrote:
> > On Fri, 2014-06-06 at 13:37 +0900, Michael Paquier wrote:
> >> On Fri, Jun 6, 2014 at 12:32 PM, John C. Frickson <john(at)frickson(dot)us> wrote:
> >>> Is there a problem with the SQLBulkOperations function? When I call
> >>> SQLBulkOperations(hstmt, SQL_ADD) I get an error: "[IM001] Driver does
> >>> not support this function".
> >>>
> >>> I'm probably missing something simple. Help please?
> >> What is the version of Postgres ODBC and ODBC lib used? the OS? I am
> >> seeing in the code that SQLBulkOperations is used if odbc version
> >> protocol is newer than 0x0300.
> >
> > Versions:
> >
> > OpenSUSE 13.1 x86_64
> > PostgreSQL 9.2.7
> > psqlODBC 08.03.0200
> > unixODBC 2.3.1

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message John C. Frickson 2014-06-06 16:14:05 Re: SQLBulkOperations
Previous Message Inoue, Hiroshi 2014-06-06 12:13:42 Re: SQLBulkOperations