Re: SQLBulkOperations - Mailing list pgsql-odbc

From John C. Frickson
Subject Re: SQLBulkOperations
Date
Msg-id 1402059306.8234.34.camel@server.frickson.pvt
Whole thread Raw
In response to Re: SQLBulkOperations  ("Inoue, Hiroshi" <inoue@tpf.co.jp>)
Responses Re: SQLBulkOperations  ("John C. Frickson" <john@frickson.us>)
Re: SQLBulkOperations  ("Inoue, Hiroshi" <inoue@tpf.co.jp>)
List 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@frickson.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



pgsql-odbc by date:

Previous
From: "Inoue, Hiroshi"
Date:
Subject: Re: SQLBulkOperations
Next
From: "John C. Frickson"
Date:
Subject: Re: SQLBulkOperations