|
10 | 10 | import org.postgresql.util.*;
|
11 | 11 |
|
12 | 12 | /**
|
13 |
| - * $Id: Connection.java,v 1.3 2000/06/06 07:45:07 peter Exp $ |
| 13 | + * $Id: Connection.java,v 1.4 2000/06/06 11:05:59 peter Exp $ |
14 | 14 | *
|
15 | 15 | * This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
|
16 | 16 | * JDBC2 versions of the Connection class.
|
@@ -317,7 +317,8 @@ public java.sql.ResultSet ExecSQL(String sql) throws SQLException
|
317 | 317 | int fqp = 0;
|
318 | 318 | boolean hfr = false;
|
319 | 319 | String recv_status = null, msg;
|
320 |
| - int update_count = 1; |
| 320 | + int update_count = 1; |
| 321 | + int insert_oid = 0; |
321 | 322 | SQLException final_error = null;
|
322 | 323 |
|
323 | 324 | // Commented out as the backend can now handle queries
|
@@ -359,12 +360,19 @@ public java.sql.ResultSet ExecSQL(String sql) throws SQLException
|
359 | 360 | recv_status = pg_stream.ReceiveString(8192);
|
360 | 361 |
|
361 | 362 | // Now handle the update count correctly.
|
362 |
| - if(recv_status.startsWith("INSERT") || recv_status.startsWith("UPDATE")) { |
| 363 | + if(recv_status.startsWith("INSERT") || recv_status.startsWith("UPDATE") || recv_status.startsWith("DELETE")) { |
363 | 364 | try {
|
364 | 365 | update_count = Integer.parseInt(recv_status.substring(1+recv_status.lastIndexOf(' ')));
|
365 | 366 | } catch(NumberFormatException nfe) {
|
366 | 367 | throw new PSQLException("postgresql.con.fathom",recv_status);
|
367 | 368 | }
|
| 369 | + if(recv_status.startsWith("INSERT")) { |
| 370 | + try { |
| 371 | + insert_oid = Integer.parseInt(recv_status.substring(1+recv_status.indexOf(' '),recv_status.lastIndexOf(' '))); |
| 372 | + } catch(NumberFormatException nfe) { |
| 373 | + throw new PSQLException("postgresql.con.fathom",recv_status); |
| 374 | + } |
| 375 | + } |
368 | 376 | }
|
369 | 377 | if (fields != null)
|
370 | 378 | hfr = true;
|
@@ -425,7 +433,7 @@ public java.sql.ResultSet ExecSQL(String sql) throws SQLException
|
425 | 433 | if (final_error != null)
|
426 | 434 | throw final_error;
|
427 | 435 |
|
428 |
| - return getResultSet(this, fields, tuples, recv_status, update_count); |
| 436 | + return getResultSet(this, fields, tuples, recv_status, update_count, insert_oid); |
429 | 437 | }
|
430 | 438 | }
|
431 | 439 |
|
@@ -727,7 +735,7 @@ private void initObjectTypes()
|
727 | 735 | * This returns a resultset. It must be overridden, so that the correct
|
728 | 736 | * version (from jdbc1 or jdbc2) are returned.
|
729 | 737 | */
|
730 |
| - protected abstract java.sql.ResultSet getResultSet(org.postgresql.Connection conn, Field[] fields, Vector tuples, String status, int updateCount) throws SQLException; |
| 738 | + protected abstract java.sql.ResultSet getResultSet(org.postgresql.Connection conn, Field[] fields, Vector tuples, String status, int updateCount,int insertOID) throws SQLException; |
731 | 739 |
|
732 | 740 | public abstract void close() throws SQLException;
|
733 | 741 |
|
|
0 commit comments