diff options
author | Dave Cramer <davec@fastcrypt.com> | 2002-03-21 02:52:37 +0000 |
---|---|---|
committer | Dave Cramer <davec@fastcrypt.com> | 2002-03-21 02:52:37 +0000 |
commit | 54cc549d8f2505fa4a3bd0aae382247497a4c613 (patch) | |
tree | 23a4d903b1ed8cdbd1cfb6173c2c2f44247b683e /src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java | |
parent | 00923229c2f076d241daf03dbc05e1458539c6d3 (diff) | |
download | postgresql-54cc549d8f2505fa4a3bd0aae382247497a4c613.tar.gz |
modifications to the way the protocol is handled to be consistent with
QueryExecutor. This includes:
1) only exit after we receive a 'Z' packet
2) append error messages to a buffer and throw the exception at the end
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java')
-rw-r--r-- | src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java b/src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java index 5c7850147f..2581f59b52 100644 --- a/src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java +++ b/src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java @@ -98,7 +98,9 @@ public class Fastpath // Now loop, reading the results Object result = null; // our result - while (true) + StringBuffer errorMessage = null; + boolean loop = true; + while (loop) { int in = stream.ReceiveChar(); //DriverManager.println("ReceiveChar() = "+in+" '"+((char)in)+"'"); @@ -128,8 +130,10 @@ public class Fastpath //------------------------------ // Error message returned case 'E': - throw new PSQLException("postgresql.fp.error", stream.ReceiveString(conn.getEncoding())); - + if ( errorMessage == null ) + errorMessage = new StringBuffer(); + errorMessage.append(stream.ReceiveString(conn.getEncoding())); + break; //------------------------------ // Notice from backend case 'N': @@ -143,15 +147,22 @@ public class Fastpath // processed earlier. If no result, this already contains null case '0': //DriverManager.println("returning "+result); - return result; - + // return result; + break; case 'Z': + // cause the loop to exit + loop = false; break; default: throw new PSQLException("postgresql.fp.protocol", new Character((char)in)); } } + + if ( errorMessage != null ) + throw new PSQLException("postgresql.fp.error", errorMessage.toString()); + + return result; } } |