pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: j.letzel@t-online.de <j.letzel@t-online.de>
To: pgsql-odbc@postgresql.org
Subject: SQL_CONCUR_LOCK not supported ?
Date: Tue, 22 Jan 2013 13:58:23 +0100
Message-ID: <1TxdQl-1601qa0@fwd17.aul.t-online.de> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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

Message-ID: <1TxdQl-1601qa0@fwd17.aul.t-online.de>
Permalink:  ../1TxdQl-1601qa0@fwd17.aul.t-online.de/
Also on:    postgresql.org/message-id/1TxdQl-1601qa0@fwd17.aul.t-online.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: j.letzel@t-online.de
  Subject: Re: SQL_CONCUR_LOCK not supported ?
  In-Reply-To: <1TxdQl-1601qa0@fwd17.aul.t-online.de>
  References: <1TxdQl-1601qa0@fwd17.aul.t-online.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox