01: /*-------------------------------------------------------------------------
02: *
03: * Copyright (c) 2004-2005, PostgreSQL Global Development Group
04: * Copyright (c) 2004, Open Cloud Limited.
05: *
06: * IDENTIFICATION
07: * $PostgreSQL: pgjdbc/org/postgresql/jdbc2/ResultWrapper.java,v 1.4 2005/01/11 08:25:46 jurka Exp $
08: *
09: *-------------------------------------------------------------------------
10: */
11: package org.postgresql.jdbc2;
12:
13: import java.sql.*;
14:
15: /**
16: * Helper class that storing result info. This handles both the
17: * ResultSet and no-ResultSet result cases with a single interface for
18: * inspecting and stepping through them.
19: *
20: * @author Oliver Jowett (oliver@opencloud.com)
21: */
22: public class ResultWrapper {
23: public ResultWrapper(ResultSet rs) {
24: this .rs = rs;
25: this .updateCount = -1;
26: this .insertOID = -1;
27: }
28:
29: public ResultWrapper(int updateCount, long insertOID) {
30: this .rs = null;
31: this .updateCount = updateCount;
32: this .insertOID = insertOID;
33: }
34:
35: public ResultSet getResultSet() {
36: return rs;
37: }
38:
39: public int getUpdateCount() {
40: return updateCount;
41: }
42:
43: public long getInsertOID() {
44: return insertOID;
45: }
46:
47: public ResultWrapper getNext() {
48: return next;
49: }
50:
51: public void append(ResultWrapper newResult) {
52: ResultWrapper tail = this ;
53: while (tail.next != null)
54: tail = tail.next;
55:
56: tail.next = newResult;
57: }
58:
59: private final ResultSet rs;
60: private final int updateCount;
61: private final long insertOID;
62: private ResultWrapper next;
63: }
|