Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TxdQw-0006N8-Rz for pgsql-odbc@arkaria.postgresql.org; Tue, 22 Jan 2013 12:58:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TxdQw-0006sa-Cm for pgsql-odbc@arkaria.postgresql.org; Tue, 22 Jan 2013 12:58:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TxdQv-0006sV-T4 for pgsql-odbc@postgresql.org; Tue, 22 Jan 2013 12:58:33 +0000 Received: from mailout06.t-online.de ([194.25.134.19]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TxdQt-0007My-LH for pgsql-odbc@postgresql.org; Tue, 22 Jan 2013 12:58:33 +0000 Received: from fwd17.aul.t-online.de (fwd17.aul.t-online.de ) by mailout06.t-online.de with smtp id 1TxdQr-0002tc-7t; Tue, 22 Jan 2013 13:58:29 +0100 Received: from localhost (S81fmUZHZhw1EMqVwAnWbi2ezyH7uureWEcHnO8nbCM1x6eSERb1j-Eu286r8izZRO@[172.20.101.250]) by fwd17.aul.t-online.de with esmtp id 1TxdQl-1601qa0; Tue, 22 Jan 2013 13:58:23 +0100 MIME-Version: 1.0 Received: from 212.87.42.226:56197 by cmpweb23.aul.t-online.de with HTTP/1.1 (NGCS V4-0-14-3 on API V3-11-19-0) Date: Tue, 22 Jan 2013 13:58:23 +0100 Reply-To: "j.letzel@t-online.de" To: pgsql-odbc@postgresql.org X-Priority: 3 X-UMS: email X-Mailer: DTAG NGCS V4-0-14-3 Subject: SQL_CONCUR_LOCK not supported ? From: "j.letzel@t-online.de" Content-Type: multipart/alternative; boundary="=_434696ce2f55f57cfc768bdc61b4541e" Message-ID: <1TxdQl-1601qa0@fwd17.aul.t-online.de> X-ID: S81fmUZHZhw1EMqVwAnWbi2ezyH7uureWEcHnO8nbCM1x6eSERb1j-Eu286r8izZRO@t-dialin.net X-TOI-MSGID: 7a233fde-e3db-4894-b2e2-b7511b08c645 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org --=_434696ce2f55f57cfc768bdc61b4541e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit 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 --=_434696ce2f55f57cfc768bdc61b4541e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

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_F= ORWARD_ONLY);

 

SQLSetStmtAttr(SQL_ATTR_CONCURRENCY, SQL_CONCUR_L= OCK); // 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); // Tim= eout to return when a lock occours

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

SQLBindCol();

SQLBindParameter();

 

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

// !!! Postgre brings here "01S02: cursor updatab= ility changed"

 

Do I have to change the way to lock rows ?

 

I tested it with the actual PostgreSQL 9.2 and OD= BC.

 

Big thanks in advance.

 

Regards

 

Johann

 

 

 

 

 

--=_434696ce2f55f57cfc768bdc61b4541e--