SQL_CONCUR_LOCK not supported ?

From: "j(dot)letzel(at)t-online(dot)de" <j(dot)letzel(at)t-online(dot)de>
To: pgsql-odbc(at)postgresql(dot)org
Subject: SQL_CONCUR_LOCK not supported ?
Date: 2013-01-22 12:58:23
Message-ID: 1TxdQl-1601qa0@fwd17.aul.t-online.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hi again !

I am sorry that I have to bother you all with my porting problems
again.

In our backend we create special cursors for row locks like this
(works fine with MSSQL):

SQLAllocStmt(); // Create the cursor

SQLSetStmtAttr(SQL_ATTR_MAX_ROWS, 1); // The lock cursor only
delivers one row

SQLSetStmtAttr(SQL_ATTR_CURSOR_TYPE, SQL_CURSOR_FORWARD_ONLY);

SQLSetStmtAttr(SQL_ATTR_CONCURRENCY, SQL_CONCUR_LOCK); // Lock mode
that other cursor of this type will fail

// !!! Postgres changes this to SQL_CONCUR_ROWVER with "01S02
Requested value changed" !!!

SQLSetStmtAttr(SQL_ATTR_QUERY_TIMEOUT, 1); // Timeout to return when
a lock occours

SQLPrepare("SELECT col FROM table WHERE col = ? FOR UPDATE");

SQLBindCol();

SQLBindParameter();

SQLExecute(); // Lock the specified row and prevent that SELECT FOR
UPDATE from other users succeeds

// !!! Postgre brings here "01S02: cursor updatability changed"

Do I have to change the way to lock rows ?

I tested it with the actual PostgreSQL 9.2 and ODBC.

Big thanks in advance.

Regards

Johann

Browse pgsql-odbc by date

  From Date Subject
Next Message mkocherov 2013-01-22 13:32:44 EN_Destructor bug
Previous Message Johann Letzel 2013-01-22 06:02:39 Re: Bug in SQLRowCount ?