patch: complain obviously about unknown transaction states

Поиск
Список
Период
Сортировка
Искать
От
Oliver Jowett
Тема
patch: complain obviously about unknown transaction states
Дата
Msg-id
40E8C806.6070902@opencloud.com
Список
Дерево обсуждения
patch: complain obviously about unknown transaction states Oliver Jowett <oliver@opencloud.com>
Re: patch: complain obviously about unknown transaction states Kris Jurka <books@ejurka.com>
ReadyForQuery may change in 7.5, per discussion on -hackers:

   http://archives.postgresql.org/pgsql-hackers/2004-07/msg00184.php

The attached patch makes the driver generate errors on unknown 
transaction states in a ReadyForQuery message, rather than silently 
ignoring them (and probably getting confused).

-O
Index: org/postgresql/core/v3/QueryExecutorImpl.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/core/v3/QueryExecutorImpl.java,v
retrieving revision 1.1
diff -u -c -r1.1 QueryExecutorImpl.java
*** org/postgresql/core/v3/QueryExecutorImpl.java	29 Jun 2004 06:43:25 -0000	1.1
--- org/postgresql/core/v3/QueryExecutorImpl.java	5 Jul 2004 02:38:21 -0000
***************
*** 1175,1181 ****
  
  	private void receiveRFQ() throws IOException {
  		if (pgStream.ReceiveIntegerR(4) != 5)
! 			throw new IOException("unexpected length of ReadyForQuery packet");
  		
  		char tStatus = (char)pgStream.ReceiveChar();
  		if (Driver.logDebug)
--- 1175,1181 ----
  
  	private void receiveRFQ() throws IOException {
  		if (pgStream.ReceiveIntegerR(4) != 5)
! 			throw new IOException("unexpected length of ReadyForQuery message");
  		
  		char tStatus = (char)pgStream.ReceiveChar();
  		if (Driver.logDebug)
***************
*** 1193,1200 ****
  			protoConnection.setTransactionState(ProtocolConnection.TRANSACTION_FAILED);
  			break;
  		default:
! 			// Huh?
! 			break;
  		}
  	}
  
--- 1193,1199 ----
  			protoConnection.setTransactionState(ProtocolConnection.TRANSACTION_FAILED);
  			break;
  		default:
! 			throw new IOException("unexpected transaction state in ReadyForQuery message: " + (int)tStatus);
  		}
  	}
  
В списке pgsql-jdbc по дате отправления
От: Stephan Szabo
Дата:
От: Dario V. Fassi
Дата:
FAQ