- tuples.addElement(tup);
- break;
- case 'E': // Error Message
- msg = pg_stream.ReceiveString(encoding);
- final_error = new SQLException(msg);
- hfr = true;
- break;
- case 'I': // Empty Query
- int t = pg_stream.ReceiveChar();
-
- if (t != 0)
- throw new PSQLException("postgresql.con.garbled");
- if (fqp > 0)
- fqp--;
- if (fqp == 0)
- hfr = true;
- break;
- case 'N': // Error Notification
- addWarning(pg_stream.ReceiveString(encoding));
- break;
- case 'P': // Portal Name
- String pname = pg_stream.ReceiveString(encoding);
- break;
- case 'T': // MetaData Field Description
- if (fields != null)
- throw new PSQLException("postgresql.con.multres");
- fields = ReceiveFields();
- break;
- case 'Z': // backend ready for query, ignore for now :-)
- break;
- default:
- throw new PSQLException("postgresql.con.type",new Character((char)c));
- }
- }
- if (final_error != null)
- throw final_error;
-
- return getResultSet(this, stat, fields, tuples, recv_status, update_count, insert_oid);
- }
- }
-
- /**
- * Receive the field descriptions from the back end
- *
- * @return an array of the Field object describing the fields
- * @exception SQLException if a database error occurs
- */
- private Field[] ReceiveFields() throws SQLException
- {
- int nf = pg_stream.ReceiveIntegerR(2), i;
- Field[] fields = new Field[nf];
-
- for (i = 0 ; i < nf ; ++i)
- {
- String typname = pg_stream.ReceiveString(encoding);
- int typid = pg_stream.ReceiveIntegerR(4);
- int typlen = pg_stream.ReceiveIntegerR(2);
- int typmod = pg_stream.ReceiveIntegerR(4);
- fields[i] = new Field(this, typname, typid, typlen, typmod);
- }
- return fields;
+ return new QueryExecutor(sql, stat, pg_stream, this).execute();
}
/**
* This returns a resultset. It must be overridden, so that the correct
* version (from jdbc1 or jdbc2) are returned.
*/
- protected abstract java.sql.ResultSet getResultSet(org.postgresql.Connection conn,java.sql.Statement stat, Field[] fields, Vector tuples, String status, int updateCount,int insertOID) throws SQLException;
+ public abstract java.sql.ResultSet getResultSet(org.postgresql.Connection conn,java.sql.Statement stat, Field[] fields, Vector tuples, String status, int updateCount,int insertOID) throws SQLException;
/**
* In some cases, it is desirable to immediately release a Connection's