提交 2410963e 编写于 作者: B Bruce Momjian

Remove postgresql jdbc files, per Peter.

上级 934c5b84
package postgresql;
import java.sql.*;
import java.util.*;
import postgresql.util.PSQLException;
/**
* The Java SQL framework allows for multiple database drivers. Each
* driver should supply a class that implements the Driver interface
*
* <p>The DriverManager will try to load as many drivers as it can find and
* then for any given connection request, it will ask each driver in turn
* to try to connect to the target URL.
*
* <p>It is strongly recommended that each Driver class should be small and
* standalone so that the Driver class can be loaded and queried without
* bringing in vast quantities of supporting code.
*
* <p>When a Driver class is loaded, it should create an instance of itself
* and register it with the DriverManager. This means that a user can load
* and register a driver by doing Class.forName("foo.bah.Driver")
*
* @see postgresql.Connection
* @see java.sql.Driver
*/
public class Driver implements java.sql.Driver
{
// These should be in sync with the backend that the driver was
// distributed with
static final int MAJORVERSION = 6;
static final int MINORVERSION = 5;
static
{
try {
// moved the registerDriver from the constructor to here
// because some clients call the driver themselves (I know, as
// my early jdbc work did - and that was based on other examples).
// Placing it here, means that the driver is registered once only.
java.sql.DriverManager.registerDriver(new Driver());
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* Construct a new driver and register it with DriverManager
*
* @exception SQLException for who knows what!
*/
public Driver() throws SQLException
{
// Set the connectClass variable so that future calls will handle the correct
// base class
//if(System.getProperty("java.version").startsWith("1.1")) {
//connectClass = "postgresql.jdbc1.Connection";
//} else {
//connectClass = "postgresql.jdbc2.Connection";
//}
// Ok, when the above code was introduced in 6.5 it's intention was to allow
// the driver to automatically detect which version of JDBC was being used
// and to detect the version of the JVM accordingly.
//
// It did this by using the java.version parameter.
//
// However, it was quickly discovered that not all JVM's returned an easily
// parseable version number (ie "1.2") and some don't return a value at all.
// The latter came from a discussion on the advanced java list.
//
// So, to solve this, I've moved the decision out of the driver, and it's now
// a compile time parameter.
//
// For this to work, the Makefile creates a pseudo class which contains the class
// name that will actually make the connection.
}
/**
* Try to make a database connection to the given URL. The driver
* should return "null" if it realizes it is the wrong kind of
* driver to connect to the given URL. This will be common, as
* when the JDBC driverManager is asked to connect to a given URL,
* it passes the URL to each loaded driver in turn.
*
* <p>The driver should raise an SQLException if it is the right driver
* to connect to the given URL, but has trouble connecting to the
* database.
*
* <p>The java.util.Properties argument can be used to pass arbitrary
* string tag/value pairs as connection arguments. Normally, at least
* "user" and "password" properties should be included in the
* properties.
*
* Our protocol takes the forms:
* <PRE>
* jdbc:postgresql://host:port/database?param1=val1&...
* </PRE>
*
* @param url the URL of the database to connect to
* @param info a list of arbitrary tag/value pairs as connection
* arguments
* @return a connection to the URL or null if it isnt us
* @exception SQLException if a database access error occurs
* @see java.sql.Driver#connect
*/
public java.sql.Connection connect(String url, Properties info) throws SQLException
{
if((props = parseURL(url,info))==null)
return null;
DriverManager.println("Using "+DriverClass.connectClass);
try {
postgresql.Connection con = (postgresql.Connection)(Class.forName(DriverClass.connectClass).newInstance());
con.openConnection (host(), port(), props, database(), url, this);
return (java.sql.Connection)con;
} catch(ClassNotFoundException ex) {
throw new PSQLException("postgresql.jvm.version",ex);
} catch(PSQLException ex1) {
// re-throw the exception, otherwise it will be caught next, and a
// postgresql.unusual error will be returned instead.
throw ex1;
} catch(Exception ex2) {
throw new PSQLException("postgresql.unusual",ex2);
}
}
/**
* Returns true if the driver thinks it can open a connection to the
* given URL. Typically, drivers will return true if they understand
* the subprotocol specified in the URL and false if they don't. Our
* protocols start with jdbc:postgresql:
*
* @see java.sql.Driver#acceptsURL
* @param url the URL of the driver
* @return true if this driver accepts the given URL
* @exception SQLException if a database-access error occurs
* (Dont know why it would *shrug*)
*/
public boolean acceptsURL(String url) throws SQLException
{
if(parseURL(url,null)==null)
return false;
return true;
}
/**
* The getPropertyInfo method is intended to allow a generic GUI
* tool to discover what properties it should prompt a human for
* in order to get enough information to connect to a database.
*
* <p>Note that depending on the values the human has supplied so
* far, additional values may become necessary, so it may be necessary
* to iterate through several calls to getPropertyInfo
*
* @param url the Url of the database to connect to
* @param info a proposed list of tag/value pairs that will be sent on
* connect open.
* @return An array of DriverPropertyInfo objects describing
* possible properties. This array may be an empty array if
* no properties are required
* @exception SQLException if a database-access error occurs
* @see java.sql.Driver#getPropertyInfo
*/
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException
{
Properties p = parseURL(url,info);
// naughty, but its best for speed. If anyone adds a property here, then
// this _MUST_ be increased to accomodate them.
DriverPropertyInfo d,dpi[] = new DriverPropertyInfo[0];
//int i=0;
//dpi[i++] = d = new DriverPropertyInfo("auth",p.getProperty("auth","default"));
//d.description = "determines if password authentication is used";
//d.choices = new String[4];
//d.choices[0]="default"; // Get value from postgresql.auth property, defaults to trust
//d.choices[1]="trust"; // No password authentication
//d.choices[2]="password"; // Password authentication
//d.choices[3]="ident"; // Ident (RFC 1413) protocol
return dpi;
}
/**
* Gets the drivers major version number
*
* @return the drivers major version number
*/
public int getMajorVersion()
{
return MAJORVERSION;
}
/**
* Get the drivers minor version number
*
* @return the drivers minor version number
*/
public int getMinorVersion()
{
return MINORVERSION;
}
/**
* Report whether the driver is a genuine JDBC compliant driver. A
* driver may only report "true" here if it passes the JDBC compliance
* tests, otherwise it is required to return false. JDBC compliance
* requires full support for the JDBC API and full support for SQL 92
* Entry Level.
*
* <p>For PostgreSQL, this is not yet possible, as we are not SQL92
* compliant (yet).
*/
public boolean jdbcCompliant()
{
return false;
}
private Properties props;
static private String[] protocols = { "jdbc","postgresql" };
/**
* Constructs a new DriverURL, splitting the specified URL into its
* component parts
* @param url JDBC URL to parse
* @param defaults Default properties
* @return Properties with elements added from the url
* @exception SQLException
*/
Properties parseURL(String url,Properties defaults) throws SQLException
{
int state = -1;
Properties urlProps = new Properties(defaults);
String key = new String();
String value = new String();
StringTokenizer st = new StringTokenizer(url, ":/;=&?", true);
for (int count = 0; (st.hasMoreTokens()); count++) {
String token = st.nextToken();
// PM June 29 1997
// Added this, to help me understand how this works.
// Unless you want each token to be processed, leave this commented out
// but don't delete it.
//DriverManager.println("wellFormedURL: state="+state+" count="+count+" token='"+token+"'");
// PM Aug 2 1997 - Modified to allow multiple backends
if (count <= 3) {
if ((count % 2) == 1 && token.equals(":"))
;
else if((count % 2) == 0) {
boolean found=(count==0)?true:false;
for(int tmp=0;tmp<protocols.length;tmp++) {
if(token.equals(protocols[tmp])) {
// PM June 29 1997 Added this property to enable the driver
// to handle multiple backend protocols.
if(count == 2 && tmp > 0) {
urlProps.put("Protocol",token);
found=true;
}
}
}
if(found == false)
return null;
} else return null;
}
else if (count > 3) {
if (count == 4 && token.equals("/")) state = 0;
else if (count == 4) {
urlProps.put("PGDBNAME", token);
state = -2;
}
else if (count == 5 && state == 0 && token.equals("/"))
state = 1;
else if (count == 5 && state == 0)
return null;
else if (count == 6 && state == 1)
urlProps.put("PGHOST", token);
else if (count == 7 && token.equals(":")) state = 2;
else if (count == 8 && state == 2) {
try {
Integer portNumber = Integer.decode(token);
urlProps.put("PGPORT", portNumber.toString());
} catch (Exception e) {
return null;
}
}
else if ((count == 7 || count == 9) &&
(state == 1 || state == 2) && token.equals("/"))
state = -1;
else if (state == -1) {
urlProps.put("PGDBNAME", token);
state = -2;
}
else if (state <= -2 && (count % 2) == 1) {
// PM Aug 2 1997 - added tests for ? and &
if (token.equals(";") || token.equals("?") || token.equals("&") ) state = -3;
else if (token.equals("=")) state = -5;
}
else if (state <= -2 && (count % 2) == 0) {
if (state == -3) key = token;
else if (state == -5) {
value = token;
//DriverManager.println("put("+key+","+value+")");
urlProps.put(key, value);
state = -2;
}
}
}
}
// PM June 29 1997
// This now outputs the properties only if we are logging
// PM Sep 13 1999 Commented out, as it throws a Deprecation warning
// when compiled under JDK1.2.
//if(DriverManager.getLogStream() != null)
// urlProps.list(DriverManager.getLogStream());
return urlProps;
}
/**
* @return the hostname portion of the URL
*/
public String host()
{
return props.getProperty("PGHOST","localhost");
}
/**
* @return the port number portion of the URL or -1 if no port was specified
*/
public int port()
{
return Integer.parseInt(props.getProperty("PGPORT","5432"));
}
/**
* @return the database name of the URL
*/
public String database()
{
return props.getProperty("PGDBNAME");
}
/**
* @return the value of any property specified in the URL or properties
* passed to connect(), or null if not found.
*/
public String property(String name)
{
return props.getProperty(name);
}
/**
* This method was added in v6.5, and simply throws an SQLException
* for an unimplemented method. I decided to do it this way while
* implementing the JDBC2 extensions to JDBC, as it should help keep the
* overall driver size down.
*/
public static SQLException notImplemented()
{
return new PSQLException("postgresql.unimplemented");
}
}
package postgresql;
import java.lang.*;
import java.sql.*;
import java.util.*;
import postgresql.*;
import postgresql.util.*;
/**
* postgresql.Field is a class used to describe fields in a PostgreSQL
* ResultSet
*/
public class Field
{
public int length; // Internal Length of this field
public int oid; // OID of the type
public int mod; // type modifier of this field
public String name; // Name of this field
protected Connection conn; // Connection Instantation
public int sql_type = -1; // The entry in java.sql.Types for this field
public String type_name = null;// The sql type name
/**
* Construct a field based on the information fed to it.
*
* @param conn the connection this field came from
* @param name the name of the field
* @param oid the OID of the field
* @param len the length of the field
*/
public Field(Connection conn, String name, int oid, int length,int mod)
{
this.conn = conn;
this.name = name;
this.oid = oid;
this.length = length;
this.mod = mod;
}
/**
* Constructor without mod parameter.
*
* @param conn the connection this field came from
* @param name the name of the field
* @param oid the OID of the field
* @param len the length of the field
*/
public Field(Connection conn, String name, int oid, int length)
{
this(conn,name,oid,length,0);
}
/**
* @return the oid of this Field's data type
*/
public int getOID()
{
return oid;
}
/**
* the ResultSet and ResultMetaData both need to handle the SQL
* type, which is gained from another query. Note that we cannot
* use getObject() in this, since getObject uses getSQLType().
*
* @return the entry in Types that refers to this field
* @exception SQLException if a database access error occurs
*/
public int getSQLType() throws SQLException
{
if(sql_type == -1) {
type_name = (String)conn.fieldCache.get(new Integer(oid));
// it's not in the cache, so perform a query, and add the result to
// the cache
if(type_name==null) {
ResultSet result = (postgresql.ResultSet)conn.ExecSQL("select typname from pg_type where oid = " + oid);
if (result.getColumnCount() != 1 || result.getTupleCount() != 1)
throw new PSQLException("postgresql.unexpected");
result.next();
type_name = result.getString(1);
conn.fieldCache.put(new Integer(oid),type_name);
result.close();
}
sql_type = getSQLType(type_name);
}
return sql_type;
}
/**
* This returns the SQL type. It is called by the Field and DatabaseMetaData classes
* @param type_name PostgreSQL type name
* @return java.sql.Types value for oid
*/
public static int getSQLType(String type_name)
{
int sql_type = Types.OTHER; // default value
for(int i=0;i<types.length;i++)
if(type_name.equals(types[i]))
sql_type=typei[i];
return sql_type;
}
/**
* This table holds the postgresql names for the types supported.
* Any types that map to Types.OTHER (eg POINT) don't go into this table.
* They default automatically to Types.OTHER
*
* Note: This must be in the same order as below.
*
* Tip: keep these grouped together by the Types. value
*/
private static final String types[] = {
"int2",
"int4","oid",
"int8",
"cash","money",
"numeric",
"float4",
"float8",
"bpchar","char","char2","char4","char8","char16",
"varchar","text","name","filename",
"bool",
"date",
"time",
"abstime","timestamp"
};
/**
* This table holds the JDBC type for each entry above.
*
* Note: This must be in the same order as above
*
* Tip: keep these grouped together by the Types. value
*/
private static final int typei[] = {
Types.SMALLINT,
Types.INTEGER,Types.INTEGER,
Types.BIGINT,
Types.DECIMAL,Types.DECIMAL,
Types.NUMERIC,
Types.REAL,
Types.DOUBLE,
Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,
Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,
Types.BIT,
Types.DATE,
Types.TIME,
Types.TIMESTAMP,Types.TIMESTAMP
};
/**
* We also need to get the type name as returned by the back end.
* This is held in type_name AFTER a call to getSQLType. Since
* we get this information within getSQLType (if it isn't already
* done), we can just call getSQLType and throw away the result.
*
* @return the String representation of the type of this field
* @exception SQLException if a database access error occurs
*/
public String getTypeName() throws SQLException
{
int sql = getSQLType();
return type_name;
}
}
package postgresql;
import java.io.*;
import java.lang.*;
import java.net.*;
import java.util.*;
import java.sql.*;
import postgresql.*;
import postgresql.util.*;
/**
* @version 1.0 15-APR-1997
*
* This class is used by Connection & PGlobj for communicating with the
* backend.
*
* @see java.sql.Connection
*/
// This class handles all the Streamed I/O for a postgresql connection
public class PG_Stream
{
private Socket connection;
private InputStream pg_input;
private BufferedOutputStream pg_output;
/**
* Constructor: Connect to the PostgreSQL back end and return
* a stream connection.
*
* @param host the hostname to connect to
* @param port the port number that the postmaster is sitting on
* @exception IOException if an IOException occurs below it.
*/
public PG_Stream(String host, int port) throws IOException
{
connection = new Socket(host, port);
// Submitted by Jason Venner <jason@idiom.com> adds a 10x speed
// improvement on FreeBSD machines (caused by a bug in their TCP Stack)
connection.setTcpNoDelay(true);
// Buffer sizes submitted by Sverre H Huseby <sverrehu@online.no>
pg_input = new BufferedInputStream(connection.getInputStream(), 8192);
pg_output = new BufferedOutputStream(connection.getOutputStream(), 8192);
}
/**
* Sends a single character to the back end
*
* @param val the character to be sent
* @exception IOException if an I/O error occurs
*/
public void SendChar(int val) throws IOException
{
// Original code
//byte b[] = new byte[1];
//b[0] = (byte)val;
//pg_output.write(b);
// Optimised version by Sverre H. Huseby Aug 22 1999 Applied Sep 13 1999
pg_output.write((byte)val);
}
/**
* Sends an integer to the back end
*
* @param val the integer to be sent
* @param siz the length of the integer in bytes (size of structure)
* @exception IOException if an I/O error occurs
*/
public void SendInteger(int val, int siz) throws IOException
{
byte[] buf = new byte[siz];
while (siz-- > 0)
{
buf[siz] = (byte)(val & 0xff);
val >>= 8;
}
Send(buf);
}
/**
* Sends an integer to the back end in reverse order.
*
* This is required when the backend uses the routines in the
* src/backend/libpq/pqcomprim.c module.
*
* As time goes by, this should become obsolete.
*
* @param val the integer to be sent
* @param siz the length of the integer in bytes (size of structure)
* @exception IOException if an I/O error occurs
*/
public void SendIntegerReverse(int val, int siz) throws IOException
{
byte[] buf = new byte[siz];
int p=0;
while (siz-- > 0)
{
buf[p++] = (byte)(val & 0xff);
val >>= 8;
}
Send(buf);
}
/**
* Send an array of bytes to the backend
*
* @param buf The array of bytes to be sent
* @exception IOException if an I/O error occurs
*/
public void Send(byte buf[]) throws IOException
{
pg_output.write(buf);
}
/**
* Send an exact array of bytes to the backend - if the length
* has not been reached, send nulls until it has.
*
* @param buf the array of bytes to be sent
* @param siz the number of bytes to be sent
* @exception IOException if an I/O error occurs
*/
public void Send(byte buf[], int siz) throws IOException
{
Send(buf,0,siz);
}
/**
* Send an exact array of bytes to the backend - if the length
* has not been reached, send nulls until it has.
*
* @param buf the array of bytes to be sent
* @param off offset in the array to start sending from
* @param siz the number of bytes to be sent
* @exception IOException if an I/O error occurs
*/
public void Send(byte buf[], int off, int siz) throws IOException
{
int i;
pg_output.write(buf, off, ((buf.length-off) < siz ? (buf.length-off) : siz));
if((buf.length-off) < siz)
{
for (i = buf.length-off ; i < siz ; ++i)
{
pg_output.write(0);
}
}
}
/**
* Sends a packet, prefixed with the packet's length
* @param buf buffer to send
* @exception SQLException if an I/O Error returns
*/
public void SendPacket(byte[] buf) throws IOException
{
SendInteger(buf.length+4,4);
Send(buf);
}
/**
* Receives a single character from the backend
*
* @return the character received
* @exception SQLException if an I/O Error returns
*/
public int ReceiveChar() throws SQLException
{
int c = 0;
try
{
c = pg_input.read();
if (c < 0) throw new PSQLException("postgresql.stream.eof");
} catch (IOException e) {
throw new PSQLException("postgresql.stream.ioerror",e);
}
return c;
}
/**
* Receives an integer from the backend
*
* @param siz length of the integer in bytes
* @return the integer received from the backend
* @exception SQLException if an I/O error occurs
*/
public int ReceiveInteger(int siz) throws SQLException
{
int n = 0;
try
{
for (int i = 0 ; i < siz ; i++)
{
int b = pg_input.read();
if (b < 0)
throw new PSQLException("postgresql.stream.eof");
n = n | (b << (8 * i)) ;
}
} catch (IOException e) {
throw new PSQLException("postgresql.stream.ioerror",e);
}
return n;
}
/**
* Receives an integer from the backend
*
* @param siz length of the integer in bytes
* @return the integer received from the backend
* @exception SQLException if an I/O error occurs
*/
public int ReceiveIntegerR(int siz) throws SQLException
{
int n = 0;
try
{
for (int i = 0 ; i < siz ; i++)
{
int b = pg_input.read();
if (b < 0)
throw new PSQLException("postgresql.stream.eof");
n = b | (n << 8);
}
} catch (IOException e) {
throw new PSQLException("postgresql.stream.ioerror",e);
}
return n;
}
/**
* Receives a null-terminated string from the backend. Maximum of
* maxsiz bytes - if we don't see a null, then we assume something
* has gone wrong.
*
* @param maxsiz maximum length of string
* @return string from back end
* @exception SQLException if an I/O error occurs
*/
public String ReceiveString(int maxsiz) throws SQLException
{
byte[] rst = new byte[maxsiz];
int s = 0;
try
{
while (s < maxsiz)
{
int c = pg_input.read();
if (c < 0)
throw new PSQLException("postgresql.stream.eof");
else if (c == 0)
break;
else
rst[s++] = (byte)c;
}
if (s >= maxsiz)
throw new PSQLException("postgresql.stream.toomuch");
} catch (IOException e) {
throw new PSQLException("postgresql.stream.ioerror",e);
}
String v = new String(rst, 0, s);
return v;
}
/**
* Read a tuple from the back end. A tuple is a two dimensional
* array of bytes
*
* @param nf the number of fields expected
* @param bin true if the tuple is a binary tuple
* @return null if the current response has no more tuples, otherwise
* an array of strings
* @exception SQLException if a data I/O error occurs
*/
public byte[][] ReceiveTuple(int nf, boolean bin) throws SQLException
{
int i, bim = (nf + 7)/8;
byte[] bitmask = Receive(bim);
byte[][] answer = new byte[nf][0];
int whichbit = 0x80;
int whichbyte = 0;
for (i = 0 ; i < nf ; ++i)
{
boolean isNull = ((bitmask[whichbyte] & whichbit) == 0);
whichbit >>= 1;
if (whichbit == 0)
{
++whichbyte;
whichbit = 0x80;
}
if (isNull)
answer[i] = null;
else
{
int len = ReceiveIntegerR(4);
if (!bin)
len -= 4;
if (len < 0)
len = 0;
answer[i] = Receive(len);
}
}
return answer;
}
/**
* Reads in a given number of bytes from the backend
*
* @param siz number of bytes to read
* @return array of bytes received
* @exception SQLException if a data I/O error occurs
*/
private byte[] Receive(int siz) throws SQLException
{
byte[] answer = new byte[siz];
Receive(answer,0,siz);
return answer;
}
/**
* Reads in a given number of bytes from the backend
*
* @param buf buffer to store result
* @param off offset in buffer
* @param siz number of bytes to read
* @exception SQLException if a data I/O error occurs
*/
public void Receive(byte[] b,int off,int siz) throws SQLException
{
int s = 0;
try
{
while (s < siz)
{
int w = pg_input.read(b, off+s, siz - s);
if (w < 0)
throw new PSQLException("postgresql.stream.eof");
s += w;
}
} catch (IOException e) {
throw new PSQLException("postgresql.stream.ioerror",e);
}
}
/**
* This flushes any pending output to the backend. It is used primarily
* by the Fastpath code.
* @exception SQLException if an I/O error occurs
*/
public void flush() throws SQLException
{
try {
pg_output.flush();
} catch (IOException e) {
throw new PSQLException("postgresql.stream.flush",e);
}
}
/**
* Closes the connection
*
* @exception IOException if a IO Error occurs
*/
public void close() throws IOException
{
pg_output.write("X\0".getBytes());
pg_output.flush();
pg_output.close();
pg_input.close();
connection.close();
}
}
package postgresql;
import java.lang.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.sql.*;
import postgresql.largeobject.*;
import postgresql.util.*;
/**
* This class implements the common internal methods used by both JDBC 1 and
* JDBC 2 specifications.
*/
public abstract class ResultSet
{
protected Vector rows; // The results
protected Field fields[]; // The field descriptions
protected String status; // Status of the result
protected int updateCount; // How many rows did we get back?
protected int current_row; // Our pointer to where we are at
protected byte[][] this_row; // the current row result
protected Connection connection; // the connection which we returned from
protected SQLWarning warnings = null; // The warning chain
protected boolean wasNullFlag = false; // the flag for wasNull()
// We can chain multiple resultSets together - this points to
// next resultSet in the chain.
protected ResultSet next = null;
/**
* Create a new ResultSet - Note that we create ResultSets to
* represent the results of everything.
*
* @param fields an array of Field objects (basically, the
* ResultSet MetaData)
* @param tuples Vector of the actual data
* @param status the status string returned from the back end
* @param updateCount the number of rows affected by the operation
* @param cursor the positioned update/delete cursor name
*/
public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount)
{
this.connection = conn;
this.fields = fields;
this.rows = tuples;
this.status = status;
this.updateCount = updateCount;
this.this_row = null;
this.current_row = -1;
}
/**
* We at times need to know if the resultSet we are working
* with is the result of an UPDATE, DELETE or INSERT (in which
* case, we only have a row count), or of a SELECT operation
* (in which case, we have multiple fields) - this routine
* tells us.
*
* @return true if we have tuples available
*/
public boolean reallyResultSet()
{
return (fields != null);
}
/**
* Since ResultSets can be chained, we need some method of
* finding the next one in the chain. The method getNext()
* returns the next one in the chain.
*
* @return the next ResultSet, or null if there are none
*/
public java.sql.ResultSet getNext()
{
return (java.sql.ResultSet)next;
}
/**
* This following method allows us to add a ResultSet object
* to the end of the current chain.
*
* @param r the resultset to add to the end of the chain.
*/
public void append(ResultSet r)
{
if (next == null)
next = r;
else
next.append(r);
}
/**
* If we are just a place holder for results, we still need
* to get an updateCount. This method returns it.
*
* @return the updateCount
*/
public int getResultCount()
{
return updateCount;
}
/**
* We also need to provide a couple of auxiliary functions for
* the implementation of the ResultMetaData functions. In
* particular, we need to know the number of rows and the
* number of columns. Rows are also known as Tuples
*
* @return the number of rows
*/
public int getTupleCount()
{
return rows.size();
}
/**
* getColumnCount returns the number of columns
*
* @return the number of columns
*/
public int getColumnCount()
{
return fields.length;
}
/**
* Returns the status message from the backend.<p>
* It is used internally by the driver.
*
* @return the status string from the backend
*/
public String getStatusString()
{
return status;
}
/**
* returns the OID of a field.<p>
* It is used internally by the driver.
*
* @param field field id
* @return the oid of that field's type
*/
public int getColumnOID(int field)
{
return fields[field-1].getOID();
}
/**
* This is part of the JDBC API, but is required by postgresql.Field
*/
public abstract void close() throws SQLException;
public abstract boolean next() throws SQLException;
public abstract String getString(int i) throws SQLException;
}
# This is the default errors
postgresql.con.auth:The authentication type {0} is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or Subnet, and that it is using an authentication scheme supported by the driver.
postgresql.con.authfail:An error occured while getting the authentication request.
postgresql.con.call:Callable Statements are not supported at this time.
postgresql.con.creobj:Failed to create object for {0} {1}
postgresql.con.failed:The connection attempt failed because {0}
postgresql.con.fathom:Unable to fathom update count {0}
postgresql.con.garbled:Garbled data received.
postgresql.con.ioerror:An IO erro occured while sending to the backend - {0}
postgresql.con.kerb4:Kerberos 4 authentication is not supported by this driver.
postgresql.con.kerb5:Kerberos 5 authentication is not supported by this driver.
postgresql.con.multres:Cannot handle multiple result groups.
postgresql.con.pass:The password property is missing. It is mandatory.
postgresql.con.refused:Connection refused. Check that the hostname and port is correct, and that the postmaster is running with the -i flag, which enables TCP/IP networking.
postgresql.con.setup:Protocol error. Session setup failed.
postgresql.con.strobj:The object could not be stored. Check that any tables required have already been created in the database.
postgresql.con.strobjex:Failed to store object - {0}
postgresql.con.toolong:The SQL Statement is too long - {0}
postgresql.con.isolevel:Transaction isolation level {0} is not supported.
postgresql.con.tuple:Tuple received before MetaData.
postgresql.con.type:Unknown Response Type {0}
postgresql.con.user:The user property is missing. It is mandatory.
postgresql.fp.error:FastPath call returned {0}
postgresql.fp.expint:Fastpath call {0} - No result was returned and we expected an integer.
postgresql.fp.protocol:FastPath protocol error: {0}
postgresql.fp.send:Failed to send fastpath call {0} {1}
postgresql.fp.unknown:The fastpath function {0} is unknown.
postgresql.geo.box:Conversion of box failed - {0}
postgresql.geo.circle:Conversion of circle failed - {0}
postgresql.geo.line:Conversion of line failed - {0}
postgresql.geo.lseg:Conversion of lseg failed - {0}
postgresql.geo.path:Cannot tell if path is open or closed.
postgresql.geo.point:Conversion of point failed - {0}
postgresql.jvm.version:The postgresql.jar file does not contain the correct JDBC classes for this JVM. Try rebuilding. If that fails, try forcing the version supplying it to the command line using the argument -Djava.version=1.1 or -Djava.version=1.2\nException thrown was {0}
postgresql.lo.init:failed to initialise LargeObject API
postgresql.money:conversion of money failed - {0}.
postgresql.prep.is:InputStream as parameter not supported
postgresql.prep.param:No value specified for parameter {0}.
postgresql.prep.range:Parameter index out of range.
postgresql.prep.type:Unknown Types value.
postgresql.res.badbigdec:Bad BigDecimal {0}
postgresql.res.badbyte:Bad Byte {0}
postgresql.res.baddate:Bad Date Format at {0} in {1}
postgresql.res.baddouble:Bad Double {0}
postgresql.res.badfloat:Bad Float {0}
postgresql.res.badint:Bad Integer {0}
postgresql.res.badlong:Bad Long {0}
postgresql.res.badshort:Bad Short {0}
postgresql.res.badtime:Bad Time {0}
postgresql.res.badtimestamp:Bad Timestamp Format at {0} in {1}
postgresql.res.colname:The column name {0} not found.
postgresql.res.colrange:The column index is out of range.
postgresql.serial.interface:You cannot serialize an interface.
postgresql.serial.namelength:Class & Package name length cannot be longer than 32 characters. {0} is {1} characters.
postgresql.serial.noclass:No class found for {0}.
postgresql.serial.table:The table for {0} is not in the database. Contact the DBA, as the database is in an inconsistent state.
postgresql.serial.underscore:Class names may not have _ in them. You supplied {0}.
postgresql.stat.batch.empty:The batch is empty. There is nothing to execute.
postgresql.stat.batch.error:Batch entry {0} {1} was aborted.
postgresql.stat.maxfieldsize:An attempt to setMaxFieldSize() failed - compile time default in force.
postgresql.stat.noresult:No results were returned by the query.
postgresql.stat.result:A result was returned by the statement, when none was expected.
postgresql.stream.eof:The backend has broken the connection. Possibly the action you have attempted has caused it to close.
postgresql.stream.flush:An I/O error has occured while flushing the output - {0}
postgresql.stream.ioerror:An I/O error occured while reading from backend - {0}
postgresql.stream.toomuch:Too much data was received.
postgresql.unusual:Something unusual has occured to cause the driver to fail. Please report this exception: {0}
postgresql.unimplemented:This method is not yet implemented.
postgresql.unexpected:An unexpected result was returned by a query.
# This is the french version of some errors. Errors not in this file
# are handled by the parent errors.properties file.
postgresql.jvm.version:Le fichier de postgresql.jar ne contient pas les classes correctes de JDBC pour ce JVM. Try que rebuilding.\nException jetées était {0}
postgresql.unusual:Quelque chose de peu commun s'est produit pour faire échouer le gestionnaire. Veuillez enregistrer cette exception: {0}
postgresql.unimplemented:Cette méthode n'est pas encore appliquée.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册