mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
JDBC indenting, comment cleanups.
This commit is contained in:
@ -10,8 +10,8 @@ import org.postgresql.largeobject.*;
|
|||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
import org.postgresql.core.*;
|
import org.postgresql.core.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* $Id: Connection.java,v 1.35 2001/11/12 19:11:56 barry Exp $
|
* $Id: Connection.java,v 1.36 2001/11/19 22:33:37 momjian Exp $
|
||||||
*
|
*
|
||||||
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
|
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
|
||||||
* JDBC2 versions of the Connection class.
|
* JDBC2 versions of the Connection class.
|
||||||
@ -30,7 +30,7 @@ public abstract class Connection
|
|||||||
private boolean PG_STATUS;
|
private boolean PG_STATUS;
|
||||||
private String compatible;
|
private String compatible;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The encoding to use for this connection.
|
* The encoding to use for this connection.
|
||||||
*/
|
*/
|
||||||
private Encoding encoding = Encoding.defaultEncoding();
|
private Encoding encoding = Encoding.defaultEncoding();
|
||||||
@ -76,7 +76,7 @@ public abstract class Connection
|
|||||||
// Now handle notices as warnings, so things like "show" now work
|
// Now handle notices as warnings, so things like "show" now work
|
||||||
public SQLWarning firstWarning = null;
|
public SQLWarning firstWarning = null;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Cache of the current isolation level
|
* Cache of the current isolation level
|
||||||
*/
|
*/
|
||||||
private int isolationLevel = java.sql.Connection.TRANSACTION_READ_COMMITTED;
|
private int isolationLevel = java.sql.Connection.TRANSACTION_READ_COMMITTED;
|
||||||
@ -85,13 +85,13 @@ public abstract class Connection
|
|||||||
public int pid;
|
public int pid;
|
||||||
public int ckey;
|
public int ckey;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This is called by Class.forName() from within org.postgresql.Driver
|
* This is called by Class.forName() from within org.postgresql.Driver
|
||||||
*/
|
*/
|
||||||
public Connection()
|
public Connection()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This method actually opens the connection. It is called by Driver.
|
* This method actually opens the connection. It is called by Driver.
|
||||||
*
|
*
|
||||||
* @param host the hostname of the database back end
|
* @param host the hostname of the database back end
|
||||||
@ -335,7 +335,7 @@ public abstract class Connection
|
|||||||
// are common to all implementations (JDBC1 or 2), they are placed here.
|
// are common to all implementations (JDBC1 or 2), they are placed here.
|
||||||
// This should make it easy to maintain the two specifications.
|
// This should make it easy to maintain the two specifications.
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This adds a warning to the warning chain.
|
* This adds a warning to the warning chain.
|
||||||
* @param msg message to add
|
* @param msg message to add
|
||||||
*/
|
*/
|
||||||
@ -365,7 +365,7 @@ public abstract class Connection
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Send a query to the backend. Returns one of the ResultSet
|
* Send a query to the backend. Returns one of the ResultSet
|
||||||
* objects.
|
* objects.
|
||||||
*
|
*
|
||||||
@ -381,7 +381,7 @@ public abstract class Connection
|
|||||||
return ExecSQL(sql, null);
|
return ExecSQL(sql, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Send a query to the backend. Returns one of the ResultSet
|
* Send a query to the backend. Returns one of the ResultSet
|
||||||
* objects.
|
* objects.
|
||||||
*
|
*
|
||||||
@ -398,7 +398,7 @@ public abstract class Connection
|
|||||||
return new QueryExecutor(sql, stat, pg_stream, this).execute();
|
return new QueryExecutor(sql, stat, pg_stream, this).execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* In SQL, a result table can be retrieved through a cursor that
|
* In SQL, a result table can be retrieved through a cursor that
|
||||||
* is named. The current row of a result can be updated or deleted
|
* is named. The current row of a result can be updated or deleted
|
||||||
* using a positioned update/delete statement that references the
|
* using a positioned update/delete statement that references the
|
||||||
@ -416,7 +416,7 @@ public abstract class Connection
|
|||||||
this.cursor = cursor;
|
this.cursor = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* getCursorName gets the cursor name.
|
* getCursorName gets the cursor name.
|
||||||
*
|
*
|
||||||
* @return the current cursor name
|
* @return the current cursor name
|
||||||
@ -427,7 +427,7 @@ public abstract class Connection
|
|||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* We are required to bring back certain information by
|
* We are required to bring back certain information by
|
||||||
* the DatabaseMetaData class. These functions do that.
|
* the DatabaseMetaData class. These functions do that.
|
||||||
*
|
*
|
||||||
@ -441,7 +441,7 @@ public abstract class Connection
|
|||||||
return this_url;
|
return this_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Method getUserName() brings back the User Name (again, we
|
* Method getUserName() brings back the User Name (again, we
|
||||||
* saved it)
|
* saved it)
|
||||||
*
|
*
|
||||||
@ -453,7 +453,7 @@ public abstract class Connection
|
|||||||
return PG_USER;
|
return PG_USER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the character encoding to use for this connection.
|
* Get the character encoding to use for this connection.
|
||||||
*/
|
*/
|
||||||
public Encoding getEncoding() throws SQLException
|
public Encoding getEncoding() throws SQLException
|
||||||
@ -461,7 +461,7 @@ public abstract class Connection
|
|||||||
return encoding;
|
return encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This returns the Fastpath API for the current connection.
|
* This returns the Fastpath API for the current connection.
|
||||||
*
|
*
|
||||||
* <p><b>NOTE:</b> This is not part of JDBC, but allows access to
|
* <p><b>NOTE:</b> This is not part of JDBC, but allows access to
|
||||||
@ -493,7 +493,7 @@ public abstract class Connection
|
|||||||
// This holds a reference to the Fastpath API if already open
|
// This holds a reference to the Fastpath API if already open
|
||||||
private Fastpath fastpath = null;
|
private Fastpath fastpath = null;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This returns the LargeObject API for the current connection.
|
* This returns the LargeObject API for the current connection.
|
||||||
*
|
*
|
||||||
* <p><b>NOTE:</b> This is not part of JDBC, but allows access to
|
* <p><b>NOTE:</b> This is not part of JDBC, but allows access to
|
||||||
@ -522,7 +522,7 @@ public abstract class Connection
|
|||||||
// This holds a reference to the LargeObject API if already open
|
// This holds a reference to the LargeObject API if already open
|
||||||
private LargeObjectManager largeobject = null;
|
private LargeObjectManager largeobject = null;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This method is used internally to return an object based around
|
* This method is used internally to return an object based around
|
||||||
* org.postgresql's more unique data types.
|
* org.postgresql's more unique data types.
|
||||||
*
|
*
|
||||||
@ -594,7 +594,7 @@ public abstract class Connection
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This stores an object into the database.
|
* This stores an object into the database.
|
||||||
* @param o Object to store
|
* @param o Object to store
|
||||||
* @return OID of the new rectord
|
* @return OID of the new rectord
|
||||||
@ -639,7 +639,7 @@ public abstract class Connection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This allows client code to add a handler for one of org.postgresql's
|
* This allows client code to add a handler for one of org.postgresql's
|
||||||
* more unique data types.
|
* more unique data types.
|
||||||
*
|
*
|
||||||
@ -693,13 +693,13 @@ public abstract class Connection
|
|||||||
// These are required by other common classes
|
// These are required by other common classes
|
||||||
public abstract java.sql.Statement createStatement() throws SQLException;
|
public abstract java.sql.Statement createStatement() throws SQLException;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This returns a resultset. It must be overridden, so that the correct
|
* This returns a resultset. It must be overridden, so that the correct
|
||||||
* version (from jdbc1 or jdbc2) are returned.
|
* version (from jdbc1 or jdbc2) are returned.
|
||||||
*/
|
*/
|
||||||
public abstract java.sql.ResultSet getResultSet(org.postgresql.Connection conn, java.sql.Statement stat, Field[] fields, Vector tuples, String status, int updateCount, int insertOID, boolean binaryCursor) 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, boolean binaryCursor) throws SQLException;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* In some cases, it is desirable to immediately release a Connection's
|
* In some cases, it is desirable to immediately release a Connection's
|
||||||
* database and JDBC resources instead of waiting for them to be
|
* database and JDBC resources instead of waiting for them to be
|
||||||
* automatically released (cant think why off the top of my head)
|
* automatically released (cant think why off the top of my head)
|
||||||
@ -726,7 +726,7 @@ public abstract class Connection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A driver may convert the JDBC sql grammar into its system's
|
* A driver may convert the JDBC sql grammar into its system's
|
||||||
* native SQL grammar prior to sending it; nativeSQL returns the
|
* native SQL grammar prior to sending it; nativeSQL returns the
|
||||||
* native form of the statement that the driver would have sent.
|
* native form of the statement that the driver would have sent.
|
||||||
@ -741,7 +741,7 @@ public abstract class Connection
|
|||||||
return sql;
|
return sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The first warning reported by calls on this Connection is
|
* The first warning reported by calls on this Connection is
|
||||||
* returned.
|
* returned.
|
||||||
*
|
*
|
||||||
@ -756,7 +756,7 @@ public abstract class Connection
|
|||||||
return firstWarning;
|
return firstWarning;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* After this call, getWarnings returns null until a new warning
|
* After this call, getWarnings returns null until a new warning
|
||||||
* is reported for this connection.
|
* is reported for this connection.
|
||||||
*
|
*
|
||||||
@ -768,7 +768,7 @@ public abstract class Connection
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* You can put a connection in read-only mode as a hunt to enable
|
* You can put a connection in read-only mode as a hunt to enable
|
||||||
* database optimizations
|
* database optimizations
|
||||||
*
|
*
|
||||||
@ -783,7 +783,7 @@ public abstract class Connection
|
|||||||
this.readOnly = readOnly;
|
this.readOnly = readOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests to see if the connection is in Read Only Mode. Note that
|
* Tests to see if the connection is in Read Only Mode. Note that
|
||||||
* we cannot really put the database in read only mode, but we pretend
|
* we cannot really put the database in read only mode, but we pretend
|
||||||
* we can by returning the value of the readOnly flag
|
* we can by returning the value of the readOnly flag
|
||||||
@ -796,7 +796,7 @@ public abstract class Connection
|
|||||||
return readOnly;
|
return readOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* If a connection is in auto-commit mode, than all its SQL
|
* If a connection is in auto-commit mode, than all its SQL
|
||||||
* statements will be executed and committed as individual
|
* statements will be executed and committed as individual
|
||||||
* transactions. Otherwise, its SQL statements are grouped
|
* transactions. Otherwise, its SQL statements are grouped
|
||||||
@ -835,7 +835,7 @@ public abstract class Connection
|
|||||||
this.autoCommit = autoCommit;
|
this.autoCommit = autoCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* gets the current auto-commit state
|
* gets the current auto-commit state
|
||||||
*
|
*
|
||||||
* @return Current state of the auto-commit mode
|
* @return Current state of the auto-commit mode
|
||||||
@ -847,7 +847,7 @@ public abstract class Connection
|
|||||||
return this.autoCommit;
|
return this.autoCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The method commit() makes all changes made since the previous
|
* The method commit() makes all changes made since the previous
|
||||||
* commit/rollback permanent and releases any database locks currently
|
* commit/rollback permanent and releases any database locks currently
|
||||||
* held by the Connection. This method should only be used when
|
* held by the Connection. This method should only be used when
|
||||||
@ -873,7 +873,7 @@ public abstract class Connection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The method rollback() drops all changes made since the previous
|
* The method rollback() drops all changes made since the previous
|
||||||
* commit/rollback and releases any database locks currently held by
|
* commit/rollback and releases any database locks currently held by
|
||||||
* the Connection.
|
* the Connection.
|
||||||
@ -897,7 +897,7 @@ public abstract class Connection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get this Connection's current transaction isolation mode.
|
* Get this Connection's current transaction isolation mode.
|
||||||
*
|
*
|
||||||
* @return the current TRANSACTION_* mode value
|
* @return the current TRANSACTION_* mode value
|
||||||
@ -925,7 +925,7 @@ public abstract class Connection
|
|||||||
return java.sql.Connection.TRANSACTION_READ_COMMITTED;
|
return java.sql.Connection.TRANSACTION_READ_COMMITTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* You can call this method to try to change the transaction
|
* You can call this method to try to change the transaction
|
||||||
* isolation level using one of the TRANSACTION_* values.
|
* isolation level using one of the TRANSACTION_* values.
|
||||||
*
|
*
|
||||||
@ -972,7 +972,7 @@ public abstract class Connection
|
|||||||
ExecSQL(isolationLevelSQL);
|
ExecSQL(isolationLevelSQL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper method used by setTransactionIsolation(), commit(), rollback()
|
* Helper method used by setTransactionIsolation(), commit(), rollback()
|
||||||
* and setAutoCommit(). This returns the SQL string needed to
|
* and setAutoCommit(). This returns the SQL string needed to
|
||||||
* set the isolation level for a transaction. In 7.1 and later it
|
* set the isolation level for a transaction. In 7.1 and later it
|
||||||
@ -1007,7 +1007,7 @@ public abstract class Connection
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A sub-space of this Connection's database may be selected by
|
* A sub-space of this Connection's database may be selected by
|
||||||
* setting a catalog name. If the driver does not support catalogs,
|
* setting a catalog name. If the driver does not support catalogs,
|
||||||
* it will silently ignore this request
|
* it will silently ignore this request
|
||||||
@ -1019,7 +1019,7 @@ public abstract class Connection
|
|||||||
//no-op
|
//no-op
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Return the connections current catalog name, or null if no
|
* Return the connections current catalog name, or null if no
|
||||||
* catalog name is set, or we dont support catalogs.
|
* catalog name is set, or we dont support catalogs.
|
||||||
*
|
*
|
||||||
@ -1031,7 +1031,7 @@ public abstract class Connection
|
|||||||
return PG_DATABASE;
|
return PG_DATABASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Overides finalize(). If called, it closes the connection.
|
* Overides finalize(). If called, it closes the connection.
|
||||||
*
|
*
|
||||||
* This was done at the request of Rachel Greenham
|
* This was done at the request of Rachel Greenham
|
||||||
@ -1051,7 +1051,7 @@ public abstract class Connection
|
|||||||
return versionParts.nextToken(); /* "X.Y.Z" */
|
return versionParts.nextToken(); /* "X.Y.Z" */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get server version number
|
* Get server version number
|
||||||
*/
|
*/
|
||||||
public String getDBVersionNumber()
|
public String getDBVersionNumber()
|
||||||
@ -1064,7 +1064,7 @@ public abstract class Connection
|
|||||||
return (getDBVersionNumber().compareTo(ver) >= 0);
|
return (getDBVersionNumber().compareTo(ver) >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This method returns true if the compatible level set in the connection
|
* This method returns true if the compatible level set in the connection
|
||||||
* (which can be passed into the connection or specified in the URL)
|
* (which can be passed into the connection or specified in the URL)
|
||||||
* is at least the value passed to this method. This is used to toggle
|
* is at least the value passed to this method. This is used to toggle
|
||||||
@ -1082,7 +1082,7 @@ public abstract class Connection
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This returns the java.sql.Types type for a PG type oid
|
* This returns the java.sql.Types type for a PG type oid
|
||||||
*
|
*
|
||||||
* @param oid PostgreSQL type oid
|
* @param oid PostgreSQL type oid
|
||||||
@ -1111,7 +1111,7 @@ public abstract class Connection
|
|||||||
return sqlType.intValue();
|
return sqlType.intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This returns the java.sql.Types type for a PG type
|
* This returns the java.sql.Types type for a PG type
|
||||||
*
|
*
|
||||||
* @param pgTypeName PostgreSQL type name
|
* @param pgTypeName PostgreSQL type name
|
||||||
@ -1119,7 +1119,7 @@ public abstract class Connection
|
|||||||
*/
|
*/
|
||||||
public abstract int getSQLType(String pgTypeName);
|
public abstract int getSQLType(String pgTypeName);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This returns the oid for a given PG data type
|
* This returns the oid for a given PG data type
|
||||||
* @param typeName PostgreSQL type name
|
* @param typeName PostgreSQL type name
|
||||||
* @return PostgreSQL oid value for a field of this type
|
* @return PostgreSQL oid value for a field of this type
|
||||||
@ -1150,7 +1150,7 @@ public abstract class Connection
|
|||||||
return oid;
|
return oid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* We also need to get the PG type name as returned by the back end.
|
* We also need to get the PG type name as returned by the back end.
|
||||||
*
|
*
|
||||||
* @return the String representation of the type of this field
|
* @return the String representation of the type of this field
|
||||||
|
@ -5,7 +5,7 @@ import java.util.*;
|
|||||||
|
|
||||||
import org.postgresql.util.PSQLException;
|
import org.postgresql.util.PSQLException;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The Java SQL framework allows for multiple database drivers. Each
|
* The Java SQL framework allows for multiple database drivers. Each
|
||||||
* driver should supply a class that implements the Driver interface
|
* driver should supply a class that implements the Driver interface
|
||||||
*
|
*
|
||||||
@ -37,19 +37,22 @@ public class Driver implements java.sql.Driver
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
// moved the registerDriver from the constructor to here
|
// moved the registerDriver from the constructor to here
|
||||||
// because some clients call the driver themselves (I know, as
|
// because some clients call the driver themselves (I know, as
|
||||||
// my early jdbc work did - and that was based on other examples).
|
// my early jdbc work did - and that was based on other examples).
|
||||||
// Placing it here, means that the driver is registered once only.
|
// Placing it here, means that the driver is registered once only.
|
||||||
java.sql.DriverManager.registerDriver(new Driver());
|
java.sql.DriverManager.registerDriver(new Driver());
|
||||||
|
|
||||||
} catch (SQLException e) {
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Construct a new driver and register it with DriverManager
|
* Construct a new driver and register it with DriverManager
|
||||||
*
|
*
|
||||||
* @exception SQLException for who knows what!
|
* @exception SQLException for who knows what!
|
||||||
@ -81,7 +84,7 @@ public class Driver implements java.sql.Driver
|
|||||||
// name that will actually make the connection.
|
// name that will actually make the connection.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Try to make a database connection to the given URL. The driver
|
* Try to make a database connection to the given URL. The driver
|
||||||
* should return "null" if it realizes it is the wrong kind of
|
* should return "null" if it realizes it is the wrong kind of
|
||||||
* driver to connect to the given URL. This will be common, as
|
* driver to connect to the given URL. This will be common, as
|
||||||
@ -138,26 +141,33 @@ public class Driver implements java.sql.Driver
|
|||||||
Driver.debug("Error in url" + url);
|
Driver.debug("Error in url" + url);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
Driver.debug("connect " + url);
|
Driver.debug("connect " + url);
|
||||||
|
|
||||||
org.postgresql.Connection con = (org.postgresql.Connection)(Class.forName("@JDBCCONNECTCLASS@").newInstance());
|
org.postgresql.Connection con = (org.postgresql.Connection)(Class.forName("@JDBCCONNECTCLASS@").newInstance());
|
||||||
con.openConnection (host(), port(), props, database(), url, this);
|
con.openConnection (host(), port(), props, database(), url, this);
|
||||||
return (java.sql.Connection)con;
|
return (java.sql.Connection)con;
|
||||||
} catch(ClassNotFoundException ex) {
|
}
|
||||||
|
catch (ClassNotFoundException ex)
|
||||||
|
{
|
||||||
Driver.debug("error", ex);
|
Driver.debug("error", ex);
|
||||||
throw new PSQLException("postgresql.jvm.version", ex);
|
throw new PSQLException("postgresql.jvm.version", ex);
|
||||||
} catch(PSQLException ex1) {
|
}
|
||||||
|
catch (PSQLException ex1)
|
||||||
|
{
|
||||||
// re-throw the exception, otherwise it will be caught next, and a
|
// re-throw the exception, otherwise it will be caught next, and a
|
||||||
// org.postgresql.unusual error will be returned instead.
|
// org.postgresql.unusual error will be returned instead.
|
||||||
throw ex1;
|
throw ex1;
|
||||||
} catch(Exception ex2) {
|
}
|
||||||
|
catch (Exception ex2)
|
||||||
|
{
|
||||||
Driver.debug("error", ex2);
|
Driver.debug("error", ex2);
|
||||||
throw new PSQLException("postgresql.unusual", ex2);
|
throw new PSQLException("postgresql.unusual", ex2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns true if the driver thinks it can open a connection to the
|
* Returns true if the driver thinks it can open a connection to the
|
||||||
* given URL. Typically, drivers will return true if they understand
|
* given URL. Typically, drivers will return true if they understand
|
||||||
* the subprotocol specified in the URL and false if they don't. Our
|
* the subprotocol specified in the URL and false if they don't. Our
|
||||||
@ -176,7 +186,7 @@ public class Driver implements java.sql.Driver
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The getPropertyInfo method is intended to allow a generic GUI
|
* The getPropertyInfo method is intended to allow a generic GUI
|
||||||
* tool to discover what properties it should prompt a human for
|
* tool to discover what properties it should prompt a human for
|
||||||
* in order to get enough information to connect to a database.
|
* in order to get enough information to connect to a database.
|
||||||
@ -214,7 +224,7 @@ public class Driver implements java.sql.Driver
|
|||||||
return dpi;
|
return dpi;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Gets the drivers major version number
|
* Gets the drivers major version number
|
||||||
*
|
*
|
||||||
* @return the drivers major version number
|
* @return the drivers major version number
|
||||||
@ -224,7 +234,7 @@ public class Driver implements java.sql.Driver
|
|||||||
return @MAJORVERSION@;
|
return @MAJORVERSION@;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the drivers minor version number
|
* Get the drivers minor version number
|
||||||
*
|
*
|
||||||
* @return the drivers minor version number
|
* @return the drivers minor version number
|
||||||
@ -234,7 +244,7 @@ public class Driver implements java.sql.Driver
|
|||||||
return @MINORVERSION@;
|
return @MINORVERSION@;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the VERSION variable from Makefile.global
|
* Returns the VERSION variable from Makefile.global
|
||||||
*/
|
*/
|
||||||
public static String getVersion()
|
public static String getVersion()
|
||||||
@ -242,7 +252,7 @@ public class Driver implements java.sql.Driver
|
|||||||
return "@VERSION@";
|
return "@VERSION@";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Report whether the driver is a genuine JDBC compliant driver. A
|
* Report whether the driver is a genuine JDBC compliant driver. A
|
||||||
* driver may only report "true" here if it passes the JDBC compliance
|
* driver may only report "true" here if it passes the JDBC compliance
|
||||||
* tests, otherwise it is required to return false. JDBC compliance
|
* tests, otherwise it is required to return false. JDBC compliance
|
||||||
@ -261,7 +271,7 @@ public class Driver implements java.sql.Driver
|
|||||||
|
|
||||||
static private String[] protocols = { "jdbc", "postgresql" };
|
static private String[] protocols = { "jdbc", "postgresql" };
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructs a new DriverURL, splitting the specified URL into its
|
* Constructs a new DriverURL, splitting the specified URL into its
|
||||||
* component parts
|
* component parts
|
||||||
* @param url JDBC URL to parse
|
* @param url JDBC URL to parse
|
||||||
@ -277,7 +287,8 @@ public class Driver implements java.sql.Driver
|
|||||||
String value = "";
|
String value = "";
|
||||||
|
|
||||||
StringTokenizer st = new StringTokenizer(url, ":/;=&?", true);
|
StringTokenizer st = new StringTokenizer(url, ":/;=&?", true);
|
||||||
for (int count = 0; (st.hasMoreTokens()); count++) {
|
for (int count = 0; (st.hasMoreTokens()); count++)
|
||||||
|
{
|
||||||
String token = st.nextToken();
|
String token = st.nextToken();
|
||||||
|
|
||||||
// PM June 29 1997
|
// PM June 29 1997
|
||||||
@ -287,16 +298,21 @@ public class Driver implements java.sql.Driver
|
|||||||
//DriverManager.println("wellFormedURL: state="+state+" count="+count+" token='"+token+"'");
|
//DriverManager.println("wellFormedURL: state="+state+" count="+count+" token='"+token+"'");
|
||||||
|
|
||||||
// PM Aug 2 1997 - Modified to allow multiple backends
|
// PM Aug 2 1997 - Modified to allow multiple backends
|
||||||
if (count <= 3) {
|
if (count <= 3)
|
||||||
|
{
|
||||||
if ((count % 2) == 1 && token.equals(":"))
|
if ((count % 2) == 1 && token.equals(":"))
|
||||||
;
|
;
|
||||||
else if((count % 2) == 0) {
|
else if ((count % 2) == 0)
|
||||||
|
{
|
||||||
boolean found = (count == 0) ? true : false;
|
boolean found = (count == 0) ? true : false;
|
||||||
for(int tmp=0;tmp<protocols.length;tmp++) {
|
for (int tmp = 0;tmp < protocols.length;tmp++)
|
||||||
if(token.equals(protocols[tmp])) {
|
{
|
||||||
|
if (token.equals(protocols[tmp]))
|
||||||
|
{
|
||||||
// PM June 29 1997 Added this property to enable the driver
|
// PM June 29 1997 Added this property to enable the driver
|
||||||
// to handle multiple backend protocols.
|
// to handle multiple backend protocols.
|
||||||
if(count == 2 && tmp > 0) {
|
if (count == 2 && tmp > 0)
|
||||||
|
{
|
||||||
urlProps.put("Protocol", token);
|
urlProps.put("Protocol", token);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
@ -305,11 +321,16 @@ public class Driver implements java.sql.Driver
|
|||||||
|
|
||||||
if (found == false)
|
if (found == false)
|
||||||
return null;
|
return null;
|
||||||
} else return null;
|
|
||||||
}
|
}
|
||||||
else if (count > 3) {
|
else
|
||||||
if (count == 4 && token.equals("/")) state = 0;
|
return null;
|
||||||
else if (count == 4) {
|
}
|
||||||
|
else if (count > 3)
|
||||||
|
{
|
||||||
|
if (count == 4 && token.equals("/"))
|
||||||
|
state = 0;
|
||||||
|
else if (count == 4)
|
||||||
|
{
|
||||||
urlProps.put("PGDBNAME", token);
|
urlProps.put("PGDBNAME", token);
|
||||||
state = -2;
|
state = -2;
|
||||||
}
|
}
|
||||||
@ -319,30 +340,42 @@ public class Driver implements java.sql.Driver
|
|||||||
return null;
|
return null;
|
||||||
else if (count == 6 && state == 1)
|
else if (count == 6 && state == 1)
|
||||||
urlProps.put("PGHOST", token);
|
urlProps.put("PGHOST", token);
|
||||||
else if (count == 7 && token.equals(":")) state = 2;
|
else if (count == 7 && token.equals(":"))
|
||||||
else if (count == 8 && state == 2) {
|
state = 2;
|
||||||
try {
|
else if (count == 8 && state == 2)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
Integer portNumber = Integer.decode(token);
|
Integer portNumber = Integer.decode(token);
|
||||||
urlProps.put("PGPORT", portNumber.toString());
|
urlProps.put("PGPORT", portNumber.toString());
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((count == 7 || count == 9) &&
|
else if ((count == 7 || count == 9) &&
|
||||||
(state == 1 || state == 2) && token.equals("/"))
|
(state == 1 || state == 2) && token.equals("/"))
|
||||||
state = -1;
|
state = -1;
|
||||||
else if (state == -1) {
|
else if (state == -1)
|
||||||
|
{
|
||||||
urlProps.put("PGDBNAME", token);
|
urlProps.put("PGDBNAME", token);
|
||||||
state = -2;
|
state = -2;
|
||||||
}
|
}
|
||||||
else if (state <= -2 && (count % 2) == 1) {
|
else if (state <= -2 && (count % 2) == 1)
|
||||||
|
{
|
||||||
// PM Aug 2 1997 - added tests for ? and &
|
// PM Aug 2 1997 - added tests for ? and &
|
||||||
if (token.equals(";") || token.equals("?") || token.equals("&") ) state = -3;
|
if (token.equals(";") || token.equals("?") || token.equals("&") )
|
||||||
else if (token.equals("=")) state = -5;
|
state = -3;
|
||||||
|
else if (token.equals("="))
|
||||||
|
state = -5;
|
||||||
}
|
}
|
||||||
else if (state <= -2 && (count % 2) == 0) {
|
else if (state <= -2 && (count % 2) == 0)
|
||||||
if (state == -3) key = token;
|
{
|
||||||
else if (state == -5) {
|
if (state == -3)
|
||||||
|
key = token;
|
||||||
|
else if (state == -5)
|
||||||
|
{
|
||||||
value = token;
|
value = token;
|
||||||
//DriverManager.println("put("+key+","+value+")");
|
//DriverManager.println("put("+key+","+value+")");
|
||||||
urlProps.put(key, value);
|
urlProps.put(key, value);
|
||||||
@ -363,7 +396,7 @@ public class Driver implements java.sql.Driver
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the hostname portion of the URL
|
* @return the hostname portion of the URL
|
||||||
*/
|
*/
|
||||||
public String host()
|
public String host()
|
||||||
@ -371,7 +404,7 @@ public class Driver implements java.sql.Driver
|
|||||||
return props.getProperty("PGHOST", "localhost");
|
return props.getProperty("PGHOST", "localhost");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the port number portion of the URL or -1 if no port was specified
|
* @return the port number portion of the URL or -1 if no port was specified
|
||||||
*/
|
*/
|
||||||
public int port()
|
public int port()
|
||||||
@ -379,7 +412,7 @@ public class Driver implements java.sql.Driver
|
|||||||
return Integer.parseInt(props.getProperty("PGPORT", "@DEF_PGPORT@"));
|
return Integer.parseInt(props.getProperty("PGPORT", "@DEF_PGPORT@"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the database name of the URL
|
* @return the database name of the URL
|
||||||
*/
|
*/
|
||||||
public String database()
|
public String database()
|
||||||
@ -387,7 +420,7 @@ public class Driver implements java.sql.Driver
|
|||||||
return props.getProperty("PGDBNAME");
|
return props.getProperty("PGDBNAME");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the value of any property specified in the URL or properties
|
* @return the value of any property specified in the URL or properties
|
||||||
* passed to connect(), or null if not found.
|
* passed to connect(), or null if not found.
|
||||||
*/
|
*/
|
||||||
@ -396,7 +429,7 @@ public class Driver implements java.sql.Driver
|
|||||||
return props.getProperty(name);
|
return props.getProperty(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This method was added in v6.5, and simply throws an SQLException
|
* This method was added in v6.5, and simply throws an SQLException
|
||||||
* for an unimplemented method. I decided to do it this way while
|
* for an unimplemented method. I decided to do it this way while
|
||||||
* implementing the JDBC2 extensions to JDBC, as it should help keep the
|
* implementing the JDBC2 extensions to JDBC, as it should help keep the
|
||||||
@ -406,105 +439,114 @@ public class Driver implements java.sql.Driver
|
|||||||
{
|
{
|
||||||
return new PSQLException("postgresql.unimplemented");
|
return new PSQLException("postgresql.unimplemented");
|
||||||
}
|
}
|
||||||
/**
|
/*
|
||||||
* logging message at the debug level
|
* logging message at the debug level
|
||||||
* messages will be printed if the logging level is less or equal to DEBUG
|
* messages will be printed if the logging level is less or equal to DEBUG
|
||||||
*/
|
*/
|
||||||
public static void debug(String msg)
|
public static void debug(String msg)
|
||||||
{
|
{
|
||||||
if (logLevel <= DEBUG){
|
if (logLevel <= DEBUG)
|
||||||
|
{
|
||||||
DriverManager.println(msg);
|
DriverManager.println(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/*
|
||||||
* logging message at the debug level
|
* logging message at the debug level
|
||||||
* messages will be printed if the logging level is less or equal to DEBUG
|
* messages will be printed if the logging level is less or equal to DEBUG
|
||||||
*/
|
*/
|
||||||
public static void debug(String msg, Exception ex)
|
public static void debug(String msg, Exception ex)
|
||||||
{
|
{
|
||||||
if (logLevel <= DEBUG){
|
if (logLevel <= DEBUG)
|
||||||
|
{
|
||||||
DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception");
|
DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/*
|
||||||
* logging message at info level
|
* logging message at info level
|
||||||
* messages will be printed if the logging level is less or equal to INFO
|
* messages will be printed if the logging level is less or equal to INFO
|
||||||
*/
|
*/
|
||||||
public static void info(String msg)
|
public static void info(String msg)
|
||||||
{
|
{
|
||||||
if (logLevel <= INFO){
|
if (logLevel <= INFO)
|
||||||
|
{
|
||||||
DriverManager.println(msg);
|
DriverManager.println(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/*
|
||||||
* logging message at info level
|
* logging message at info level
|
||||||
* messages will be printed if the logging level is less or equal to INFO
|
* messages will be printed if the logging level is less or equal to INFO
|
||||||
*/
|
*/
|
||||||
public static void info(String msg, Exception ex)
|
public static void info(String msg, Exception ex)
|
||||||
{
|
{
|
||||||
if (logLevel <= INFO){
|
if (logLevel <= INFO)
|
||||||
|
{
|
||||||
DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception");
|
DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/*
|
||||||
* logging message at warn level
|
* logging message at warn level
|
||||||
* messages will be printed if the logging level is less or equal to WARN
|
* messages will be printed if the logging level is less or equal to WARN
|
||||||
*/
|
*/
|
||||||
public static void warn(String msg)
|
public static void warn(String msg)
|
||||||
{
|
{
|
||||||
if (logLevel <= WARN){
|
if (logLevel <= WARN)
|
||||||
|
{
|
||||||
DriverManager.println(msg);
|
DriverManager.println(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/*
|
||||||
* logging message at warn level
|
* logging message at warn level
|
||||||
* messages will be printed if the logging level is less or equal to WARN
|
* messages will be printed if the logging level is less or equal to WARN
|
||||||
*/
|
*/
|
||||||
public static void warn(String msg, Exception ex)
|
public static void warn(String msg, Exception ex)
|
||||||
{
|
{
|
||||||
if (logLevel <= WARN){
|
if (logLevel <= WARN)
|
||||||
|
{
|
||||||
DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception");
|
DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/*
|
||||||
* logging message at error level
|
* logging message at error level
|
||||||
* messages will be printed if the logging level is less or equal to ERROR
|
* messages will be printed if the logging level is less or equal to ERROR
|
||||||
*/
|
*/
|
||||||
public static void error(String msg)
|
public static void error(String msg)
|
||||||
{
|
{
|
||||||
if (logLevel <= ERROR){
|
if (logLevel <= ERROR)
|
||||||
|
{
|
||||||
DriverManager.println(msg);
|
DriverManager.println(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/*
|
||||||
* logging message at error level
|
* logging message at error level
|
||||||
* messages will be printed if the logging level is less or equal to ERROR
|
* messages will be printed if the logging level is less or equal to ERROR
|
||||||
*/
|
*/
|
||||||
public static void error(String msg, Exception ex)
|
public static void error(String msg, Exception ex)
|
||||||
{
|
{
|
||||||
if (logLevel <= ERROR){
|
if (logLevel <= ERROR)
|
||||||
|
{
|
||||||
DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception");
|
DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/*
|
||||||
* logging message at fatal level
|
* logging message at fatal level
|
||||||
* messages will be printed if the logging level is less or equal to FATAL
|
* messages will be printed if the logging level is less or equal to FATAL
|
||||||
*/
|
*/
|
||||||
public static void fatal(String msg)
|
public static void fatal(String msg)
|
||||||
{
|
{
|
||||||
if (logLevel <= FATAL){
|
if (logLevel <= FATAL)
|
||||||
|
{
|
||||||
DriverManager.println(msg);
|
DriverManager.println(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/*
|
||||||
* logging message at fatal level
|
* logging message at fatal level
|
||||||
* messages will be printed if the logging level is less or equal to FATAL
|
* messages will be printed if the logging level is less or equal to FATAL
|
||||||
*/
|
*/
|
||||||
public static void fatal(String msg, Exception ex)
|
public static void fatal(String msg, Exception ex)
|
||||||
{
|
{
|
||||||
if (logLevel <= FATAL){
|
if (logLevel <= FATAL)
|
||||||
|
{
|
||||||
DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception");
|
DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import java.util.*;
|
|||||||
import org.postgresql.*;
|
import org.postgresql.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* org.postgresql.Field is a class used to describe fields in a PostgreSQL
|
* org.postgresql.Field is a class used to describe fields in a PostgreSQL
|
||||||
* ResultSet
|
* ResultSet
|
||||||
*/
|
*/
|
||||||
@ -20,7 +20,7 @@ public class Field
|
|||||||
private Connection conn; // Connection Instantation
|
private Connection conn; // Connection Instantation
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Construct a field based on the information fed to it.
|
* Construct a field based on the information fed to it.
|
||||||
*
|
*
|
||||||
* @param conn the connection this field came from
|
* @param conn the connection this field came from
|
||||||
@ -37,7 +37,7 @@ public class Field
|
|||||||
this.mod = mod;
|
this.mod = mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructor without mod parameter.
|
* Constructor without mod parameter.
|
||||||
*
|
*
|
||||||
* @param conn the connection this field came from
|
* @param conn the connection this field came from
|
||||||
@ -50,7 +50,7 @@ public class Field
|
|||||||
this(conn, name, oid, length, 0);
|
this(conn, name, oid, length, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the oid of this Field's data type
|
* @return the oid of this Field's data type
|
||||||
*/
|
*/
|
||||||
public int getOID()
|
public int getOID()
|
||||||
@ -58,7 +58,7 @@ public class Field
|
|||||||
return oid;
|
return oid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the mod of this Field's data type
|
* @return the mod of this Field's data type
|
||||||
*/
|
*/
|
||||||
public int getMod()
|
public int getMod()
|
||||||
@ -66,7 +66,7 @@ public class Field
|
|||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the name of this Field's data type
|
* @return the name of this Field's data type
|
||||||
*/
|
*/
|
||||||
public String getName()
|
public String getName()
|
||||||
@ -74,7 +74,7 @@ public class Field
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the length of this Field's data type
|
* @return the length of this Field's data type
|
||||||
*/
|
*/
|
||||||
public int getLength()
|
public int getLength()
|
||||||
@ -82,7 +82,7 @@ public class Field
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* We also need to get the PG type name as returned by the back end.
|
* We also need to get the PG type name as returned by the back end.
|
||||||
*
|
*
|
||||||
* @return the String representation of the PG type of this field
|
* @return the String representation of the PG type of this field
|
||||||
@ -93,7 +93,7 @@ public class Field
|
|||||||
return conn.getPGType(oid);
|
return conn.getPGType(oid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* We also need to get the java.sql.types type.
|
* We also need to get the java.sql.types type.
|
||||||
*
|
*
|
||||||
* @return the int representation of the java.sql.types type of this field
|
* @return the int representation of the java.sql.types type of this field
|
||||||
|
@ -9,8 +9,8 @@ import org.postgresql.*;
|
|||||||
import org.postgresql.core.*;
|
import org.postgresql.core.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* $Id: PG_Stream.java,v 1.14 2001/10/25 05:59:59 momjian Exp $
|
* $Id: PG_Stream.java,v 1.15 2001/11/19 22:33:37 momjian Exp $
|
||||||
*
|
*
|
||||||
* This class is used by Connection & PGlobj for communicating with the
|
* This class is used by Connection & PGlobj for communicating with the
|
||||||
* backend.
|
* backend.
|
||||||
@ -28,7 +28,7 @@ public class PG_Stream
|
|||||||
BytePoolDim1 bytePoolDim1 = new BytePoolDim1();
|
BytePoolDim1 bytePoolDim1 = new BytePoolDim1();
|
||||||
BytePoolDim2 bytePoolDim2 = new BytePoolDim2();
|
BytePoolDim2 bytePoolDim2 = new BytePoolDim2();
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructor: Connect to the PostgreSQL back end and return
|
* Constructor: Connect to the PostgreSQL back end and return
|
||||||
* a stream connection.
|
* a stream connection.
|
||||||
*
|
*
|
||||||
@ -49,7 +49,7 @@ public class PG_Stream
|
|||||||
pg_output = new BufferedOutputStream(connection.getOutputStream(), 8192);
|
pg_output = new BufferedOutputStream(connection.getOutputStream(), 8192);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Sends a single character to the back end
|
* Sends a single character to the back end
|
||||||
*
|
*
|
||||||
* @param val the character to be sent
|
* @param val the character to be sent
|
||||||
@ -60,7 +60,7 @@ public class PG_Stream
|
|||||||
pg_output.write((byte)val);
|
pg_output.write((byte)val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Sends an integer to the back end
|
* Sends an integer to the back end
|
||||||
*
|
*
|
||||||
* @param val the integer to be sent
|
* @param val the integer to be sent
|
||||||
@ -79,7 +79,7 @@ public class PG_Stream
|
|||||||
Send(buf);
|
Send(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Send an array of bytes to the backend
|
* Send an array of bytes to the backend
|
||||||
*
|
*
|
||||||
* @param buf The array of bytes to be sent
|
* @param buf The array of bytes to be sent
|
||||||
@ -90,7 +90,7 @@ public class PG_Stream
|
|||||||
pg_output.write(buf);
|
pg_output.write(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Send an exact array of bytes to the backend - if the length
|
* Send an exact array of bytes to the backend - if the length
|
||||||
* has not been reached, send nulls until it has.
|
* has not been reached, send nulls until it has.
|
||||||
*
|
*
|
||||||
@ -103,7 +103,7 @@ public class PG_Stream
|
|||||||
Send(buf, 0, siz);
|
Send(buf, 0, siz);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Send an exact array of bytes to the backend - if the length
|
* Send an exact array of bytes to the backend - if the length
|
||||||
* has not been reached, send nulls until it has.
|
* has not been reached, send nulls until it has.
|
||||||
*
|
*
|
||||||
@ -126,7 +126,7 @@ public class PG_Stream
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Receives a single character from the backend
|
* Receives a single character from the backend
|
||||||
*
|
*
|
||||||
* @return the character received
|
* @return the character received
|
||||||
@ -149,7 +149,7 @@ public class PG_Stream
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Receives an integer from the backend
|
* Receives an integer from the backend
|
||||||
*
|
*
|
||||||
* @param siz length of the integer in bytes
|
* @param siz length of the integer in bytes
|
||||||
@ -178,7 +178,7 @@ public class PG_Stream
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Receives an integer from the backend
|
* Receives an integer from the backend
|
||||||
*
|
*
|
||||||
* @param siz length of the integer in bytes
|
* @param siz length of the integer in bytes
|
||||||
@ -207,7 +207,7 @@ public class PG_Stream
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Receives a null-terminated string from the backend. If we don't see a
|
* Receives a null-terminated string from the backend. If we don't see a
|
||||||
* null, then we assume something has gone wrong.
|
* null, then we assume something has gone wrong.
|
||||||
*
|
*
|
||||||
@ -258,7 +258,7 @@ public class PG_Stream
|
|||||||
return encoding.decode(rst, 0, s);
|
return encoding.decode(rst, 0, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Read a tuple from the back end. A tuple is a two dimensional
|
* Read a tuple from the back end. A tuple is a two dimensional
|
||||||
* array of bytes
|
* array of bytes
|
||||||
*
|
*
|
||||||
@ -301,7 +301,7 @@ public class PG_Stream
|
|||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Reads in a given number of bytes from the backend
|
* Reads in a given number of bytes from the backend
|
||||||
*
|
*
|
||||||
* @param siz number of bytes to read
|
* @param siz number of bytes to read
|
||||||
@ -315,7 +315,7 @@ public class PG_Stream
|
|||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Reads in a given number of bytes from the backend
|
* Reads in a given number of bytes from the backend
|
||||||
*
|
*
|
||||||
* @param buf buffer to store result
|
* @param buf buffer to store result
|
||||||
@ -343,7 +343,7 @@ public class PG_Stream
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This flushes any pending output to the backend. It is used primarily
|
* This flushes any pending output to the backend. It is used primarily
|
||||||
* by the Fastpath code.
|
* by the Fastpath code.
|
||||||
* @exception SQLException if an I/O error occurs
|
* @exception SQLException if an I/O error occurs
|
||||||
@ -360,7 +360,7 @@ public class PG_Stream
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Closes the connection
|
* Closes the connection
|
||||||
*
|
*
|
||||||
* @exception IOException if a IO Error occurs
|
* @exception IOException if a IO Error occurs
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
* Redistribution and use of this software and associated documentation
|
* Redistribution and use of this software and associated documentation
|
||||||
* ("Software"), with or without modification, are permitted provided
|
* ("Software"), with or without modification, are permitted provided
|
||||||
* that the following conditions are met:
|
* that the following conditions are met:
|
||||||
@ -40,7 +40,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* $Id: PostgresqlDataSource.java,v 1.3 2001/10/25 05:59:59 momjian Exp $
|
* $Id: PostgresqlDataSource.java,v 1.4 2001/11/19 22:33:37 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ import org.postgresql.util.PSQLException;
|
|||||||
import org.postgresql.xa.XADataSourceImpl;
|
import org.postgresql.xa.XADataSourceImpl;
|
||||||
//---------
|
//---------
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Implements a JDBC 2.0 {@link javax.sql.DataSource} for the
|
* Implements a JDBC 2.0 {@link javax.sql.DataSource} for the
|
||||||
* PostgreSQL driver with JNDI persistance support. XA and pooled
|
* PostgreSQL driver with JNDI persistance support. XA and pooled
|
||||||
* connection support is also available, but the application must
|
* connection support is also available, but the application must
|
||||||
@ -127,45 +127,45 @@ public class PostgresqlDataSource
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Holds the timeout for opening a new connection, specified
|
* Holds the timeout for opening a new connection, specified
|
||||||
* in seconds. The default is obtained from the JDBC driver.
|
* in seconds. The default is obtained from the JDBC driver.
|
||||||
*/
|
*/
|
||||||
private int _loginTimeout;
|
private int _loginTimeout;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Holds the user's account name.
|
* Holds the user's account name.
|
||||||
*/
|
*/
|
||||||
private String _user;
|
private String _user;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Holds the database password.
|
* Holds the database password.
|
||||||
*/
|
*/
|
||||||
private String _password;
|
private String _password;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Holds the name of the particular database on the server.
|
* Holds the name of the particular database on the server.
|
||||||
*/
|
*/
|
||||||
private String _databaseName;
|
private String _databaseName;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Description of this datasource.
|
* Description of this datasource.
|
||||||
*/
|
*/
|
||||||
private String _description = "PostgreSQL DataSource";
|
private String _description = "PostgreSQL DataSource";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Holds the database server name. If null, this is
|
* Holds the database server name. If null, this is
|
||||||
* assumed to be the localhost.
|
* assumed to be the localhost.
|
||||||
*/
|
*/
|
||||||
private String _serverName;
|
private String _serverName;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Holds the port number where a server is listening.
|
* Holds the port number where a server is listening.
|
||||||
* The default value will open a connection with an
|
* The default value will open a connection with an
|
||||||
* unspecified port.
|
* unspecified port.
|
||||||
@ -173,7 +173,7 @@ public class PostgresqlDataSource
|
|||||||
private int _portNumber = DEFAULT_PORT;
|
private int _portNumber = DEFAULT_PORT;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The default port number. Since we open the connection
|
* The default port number. Since we open the connection
|
||||||
* without specifying the port if it's the default one,
|
* without specifying the port if it's the default one,
|
||||||
* this value can be meaningless.
|
* this value can be meaningless.
|
||||||
@ -181,7 +181,7 @@ public class PostgresqlDataSource
|
|||||||
private static final int DEFAULT_PORT = 0;
|
private static final int DEFAULT_PORT = 0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Holds the log writer to which all messages should be
|
* Holds the log writer to which all messages should be
|
||||||
* printed. The default writer is obtained from the driver
|
* printed. The default writer is obtained from the driver
|
||||||
* manager, but it can be specified at the datasource level
|
* manager, but it can be specified at the datasource level
|
||||||
@ -190,7 +190,7 @@ public class PostgresqlDataSource
|
|||||||
private transient PrintWriter _logWriter;
|
private transient PrintWriter _logWriter;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Each datasource maintains it's own driver, in case of
|
* Each datasource maintains it's own driver, in case of
|
||||||
* driver-specific setup (e.g. pools, log writer).
|
* driver-specific setup (e.g. pools, log writer).
|
||||||
*/
|
*/
|
||||||
@ -335,7 +335,7 @@ public class PostgresqlDataSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Sets the name of the particular database on the server.
|
* Sets the name of the particular database on the server.
|
||||||
* The standard name for this property is <tt>databaseName</tt>.
|
* The standard name for this property is <tt>databaseName</tt>.
|
||||||
*
|
*
|
||||||
@ -349,7 +349,7 @@ public class PostgresqlDataSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the name of the particular database on the server.
|
* Returns the name of the particular database on the server.
|
||||||
* The standard name for this property is <tt>databaseName</tt>.
|
* The standard name for this property is <tt>databaseName</tt>.
|
||||||
*
|
*
|
||||||
@ -361,7 +361,7 @@ public class PostgresqlDataSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Sets the description of this datasource.
|
* Sets the description of this datasource.
|
||||||
* The standard name for this property is <tt>description</tt>.
|
* The standard name for this property is <tt>description</tt>.
|
||||||
*
|
*
|
||||||
@ -375,7 +375,7 @@ public class PostgresqlDataSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the description of this datasource.
|
* Returns the description of this datasource.
|
||||||
* The standard name for this property is <tt>description</tt>.
|
* The standard name for this property is <tt>description</tt>.
|
||||||
*
|
*
|
||||||
@ -387,7 +387,7 @@ public class PostgresqlDataSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Sets the database password.
|
* Sets the database password.
|
||||||
* The standard name for this property is <tt>password</tt>.
|
* The standard name for this property is <tt>password</tt>.
|
||||||
*
|
*
|
||||||
@ -399,7 +399,7 @@ public class PostgresqlDataSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the database password.
|
* Returns the database password.
|
||||||
* The standard name for this property is <tt>password</tt>.
|
* The standard name for this property is <tt>password</tt>.
|
||||||
*
|
*
|
||||||
@ -411,7 +411,7 @@ public class PostgresqlDataSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Sets the port number where a server is listening.
|
* Sets the port number where a server is listening.
|
||||||
* The standard name for this property is <tt>portNumber</tt>.
|
* The standard name for this property is <tt>portNumber</tt>.
|
||||||
*
|
*
|
||||||
@ -423,7 +423,7 @@ public class PostgresqlDataSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the port number where a server is listening.
|
* Returns the port number where a server is listening.
|
||||||
* The standard name for this property is <tt>portNumber</tt>.
|
* The standard name for this property is <tt>portNumber</tt>.
|
||||||
*
|
*
|
||||||
@ -435,7 +435,7 @@ public class PostgresqlDataSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Sets the database server name.
|
* Sets the database server name.
|
||||||
|
|
||||||
* The standard name for this property is <tt>serverName</tt>.
|
* The standard name for this property is <tt>serverName</tt>.
|
||||||
@ -448,7 +448,7 @@ public class PostgresqlDataSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the database server name.
|
* Returns the database server name.
|
||||||
* The standard name for this property is <tt>serverName</tt>.
|
* The standard name for this property is <tt>serverName</tt>.
|
||||||
*
|
*
|
||||||
@ -460,7 +460,7 @@ public class PostgresqlDataSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Sets the user's account name.
|
* Sets the user's account name.
|
||||||
* The standard name for this property is <tt>user</tt>.
|
* The standard name for this property is <tt>user</tt>.
|
||||||
*
|
*
|
||||||
@ -472,7 +472,7 @@ public class PostgresqlDataSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the user's account name.
|
* Returns the user's account name.
|
||||||
* The standard name for this property is <tt>user</tt>.
|
* The standard name for this property is <tt>user</tt>.
|
||||||
*
|
*
|
||||||
@ -484,7 +484,7 @@ public class PostgresqlDataSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns true if this datasource and the other are equal.
|
* Returns true if this datasource and the other are equal.
|
||||||
* The two datasources are equal if and only if they will produce
|
* The two datasources are equal if and only if they will produce
|
||||||
* the exact same connections. Connection properties like database
|
* the exact same connections. Connection properties like database
|
||||||
|
@ -9,7 +9,7 @@ import java.sql.*;
|
|||||||
import org.postgresql.largeobject.*;
|
import org.postgresql.largeobject.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This class implements the common internal methods used by both JDBC 1 and
|
* This class implements the common internal methods used by both JDBC 1 and
|
||||||
* JDBC 2 specifications.
|
* JDBC 2 specifications.
|
||||||
*/
|
*/
|
||||||
@ -31,7 +31,7 @@ public abstract class ResultSet
|
|||||||
// next resultSet in the chain.
|
// next resultSet in the chain.
|
||||||
protected ResultSet next = null;
|
protected ResultSet next = null;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Create a new ResultSet - Note that we create ResultSets to
|
* Create a new ResultSet - Note that we create ResultSets to
|
||||||
* represent the results of everything.
|
* represent the results of everything.
|
||||||
*
|
*
|
||||||
@ -56,7 +56,7 @@ public abstract class ResultSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Create a new ResultSet - Note that we create ResultSets to
|
* Create a new ResultSet - Note that we create ResultSets to
|
||||||
* represent the results of everything.
|
* represent the results of everything.
|
||||||
*
|
*
|
||||||
@ -72,7 +72,7 @@ public abstract class ResultSet
|
|||||||
this(conn, fields, tuples, status, updateCount, 0, false);
|
this(conn, fields, tuples, status, updateCount, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* We at times need to know if the resultSet we are working
|
* We at times need to know if the resultSet we are working
|
||||||
* with is the result of an UPDATE, DELETE or INSERT (in which
|
* with is the result of an UPDATE, DELETE or INSERT (in which
|
||||||
* case, we only have a row count), or of a SELECT operation
|
* case, we only have a row count), or of a SELECT operation
|
||||||
@ -86,7 +86,7 @@ public abstract class ResultSet
|
|||||||
return (fields != null);
|
return (fields != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Since ResultSets can be chained, we need some method of
|
* Since ResultSets can be chained, we need some method of
|
||||||
* finding the next one in the chain. The method getNext()
|
* finding the next one in the chain. The method getNext()
|
||||||
* returns the next one in the chain.
|
* returns the next one in the chain.
|
||||||
@ -98,7 +98,7 @@ public abstract class ResultSet
|
|||||||
return (java.sql.ResultSet)next;
|
return (java.sql.ResultSet)next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This following method allows us to add a ResultSet object
|
* This following method allows us to add a ResultSet object
|
||||||
* to the end of the current chain.
|
* to the end of the current chain.
|
||||||
*
|
*
|
||||||
@ -112,7 +112,7 @@ public abstract class ResultSet
|
|||||||
next.append(r);
|
next.append(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* If we are just a place holder for results, we still need
|
* If we are just a place holder for results, we still need
|
||||||
* to get an updateCount. This method returns it.
|
* to get an updateCount. This method returns it.
|
||||||
*
|
*
|
||||||
@ -123,7 +123,7 @@ public abstract class ResultSet
|
|||||||
return updateCount;
|
return updateCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* We also need to provide a couple of auxiliary functions for
|
* We also need to provide a couple of auxiliary functions for
|
||||||
* the implementation of the ResultMetaData functions. In
|
* the implementation of the ResultMetaData functions. In
|
||||||
* particular, we need to know the number of rows and the
|
* particular, we need to know the number of rows and the
|
||||||
@ -136,7 +136,7 @@ public abstract class ResultSet
|
|||||||
return rows.size();
|
return rows.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* getColumnCount returns the number of columns
|
* getColumnCount returns the number of columns
|
||||||
*
|
*
|
||||||
* @return the number of columns
|
* @return the number of columns
|
||||||
@ -146,7 +146,7 @@ public abstract class ResultSet
|
|||||||
return fields.length;
|
return fields.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the status message from the backend.<p>
|
* Returns the status message from the backend.<p>
|
||||||
* It is used internally by the driver.
|
* It is used internally by the driver.
|
||||||
*
|
*
|
||||||
@ -157,7 +157,7 @@ public abstract class ResultSet
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* returns the OID of a field.<p>
|
* returns the OID of a field.<p>
|
||||||
* It is used internally by the driver.
|
* It is used internally by the driver.
|
||||||
*
|
*
|
||||||
@ -169,7 +169,7 @@ public abstract class ResultSet
|
|||||||
return fields[field -1].getOID();
|
return fields[field -1].getOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* returns the OID of the last inserted row
|
* returns the OID of the last inserted row
|
||||||
*/
|
*/
|
||||||
public int getInsertedOID()
|
public int getInsertedOID()
|
||||||
@ -177,14 +177,14 @@ public abstract class ResultSet
|
|||||||
return insertOID;
|
return insertOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This is part of the JDBC API, but is required by org.postgresql.Field
|
* This is part of the JDBC API, but is required by org.postgresql.Field
|
||||||
*/
|
*/
|
||||||
public abstract void close() throws SQLException;
|
public abstract void close() throws SQLException;
|
||||||
public abstract boolean next() throws SQLException;
|
public abstract boolean next() throws SQLException;
|
||||||
public abstract String getString(int i) throws SQLException;
|
public abstract String getString(int i) throws SQLException;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This is used to fix get*() methods on Money fields. It should only be
|
* This is used to fix get*() methods on Money fields. It should only be
|
||||||
* used by those methods!
|
* used by those methods!
|
||||||
*
|
*
|
||||||
|
@ -3,7 +3,7 @@ package org.postgresql;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import org.postgresql.util.PSQLException;
|
import org.postgresql.util.PSQLException;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This class defines methods implemented by the two subclasses
|
* This class defines methods implemented by the two subclasses
|
||||||
* org.postgresql.jdbc1.Statement and org.postgresql.jdbc2.Statement that are
|
* org.postgresql.jdbc1.Statement and org.postgresql.jdbc2.Statement that are
|
||||||
* unique to PostgreSQL's JDBC driver.
|
* unique to PostgreSQL's JDBC driver.
|
||||||
@ -49,7 +49,7 @@ public abstract class Statement
|
|||||||
public Statement()
|
public Statement()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the status message from the current Result.<p>
|
* Returns the status message from the current Result.<p>
|
||||||
* This is used internally by the driver.
|
* This is used internally by the driver.
|
||||||
*
|
*
|
||||||
@ -62,7 +62,7 @@ public abstract class Statement
|
|||||||
return ((org.postgresql.ResultSet) result).getStatusString();
|
return ((org.postgresql.ResultSet) result).getStatusString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The maxRows limit is set to limit the number of rows that
|
* The maxRows limit is set to limit the number of rows that
|
||||||
* any ResultSet can contain. If the limit is exceeded, the
|
* any ResultSet can contain. If the limit is exceeded, the
|
||||||
* excess rows are silently dropped.
|
* excess rows are silently dropped.
|
||||||
@ -75,7 +75,7 @@ public abstract class Statement
|
|||||||
return maxrows;
|
return maxrows;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set the maximum number of rows
|
* Set the maximum number of rows
|
||||||
*
|
*
|
||||||
* @param max the new max rows limit; zero means unlimited
|
* @param max the new max rows limit; zero means unlimited
|
||||||
@ -87,7 +87,7 @@ public abstract class Statement
|
|||||||
maxrows = max;
|
maxrows = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* If escape scanning is on (the default), the driver will do escape
|
* If escape scanning is on (the default), the driver will do escape
|
||||||
* substitution before sending the SQL to the database.
|
* substitution before sending the SQL to the database.
|
||||||
*
|
*
|
||||||
@ -99,7 +99,7 @@ public abstract class Statement
|
|||||||
escapeProcessing = enable;
|
escapeProcessing = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The queryTimeout limit is the number of seconds the driver
|
* The queryTimeout limit is the number of seconds the driver
|
||||||
* will wait for a Statement to execute. If the limit is
|
* will wait for a Statement to execute. If the limit is
|
||||||
* exceeded, a SQLException is thrown.
|
* exceeded, a SQLException is thrown.
|
||||||
@ -112,7 +112,7 @@ public abstract class Statement
|
|||||||
return timeout;
|
return timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Sets the queryTimeout limit
|
* Sets the queryTimeout limit
|
||||||
*
|
*
|
||||||
* @param seconds - the new query timeout limit in seconds
|
* @param seconds - the new query timeout limit in seconds
|
||||||
@ -123,7 +123,7 @@ public abstract class Statement
|
|||||||
timeout = seconds;
|
timeout = seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The first warning reported by calls on this Statement is
|
* The first warning reported by calls on this Statement is
|
||||||
* returned. A Statement's execute methods clear its SQLWarning
|
* returned. A Statement's execute methods clear its SQLWarning
|
||||||
* chain. Subsequent Statement warnings will be chained to this
|
* chain. Subsequent Statement warnings will be chained to this
|
||||||
@ -144,7 +144,7 @@ public abstract class Statement
|
|||||||
return warnings;
|
return warnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The maxFieldSize limit (in bytes) is the maximum amount of
|
* The maxFieldSize limit (in bytes) is the maximum amount of
|
||||||
* data returned for any column value; it only applies to
|
* data returned for any column value; it only applies to
|
||||||
* BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR and LONGVARCHAR
|
* BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR and LONGVARCHAR
|
||||||
@ -159,7 +159,7 @@ public abstract class Statement
|
|||||||
return 8192; // We cannot change this
|
return 8192; // We cannot change this
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Sets the maxFieldSize - NOT! - We throw an SQLException just
|
* Sets the maxFieldSize - NOT! - We throw an SQLException just
|
||||||
* to inform them to stop doing this.
|
* to inform them to stop doing this.
|
||||||
*
|
*
|
||||||
@ -171,7 +171,7 @@ public abstract class Statement
|
|||||||
throw new PSQLException("postgresql.stat.maxfieldsize");
|
throw new PSQLException("postgresql.stat.maxfieldsize");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* After this call, getWarnings returns null until a new warning
|
* After this call, getWarnings returns null until a new warning
|
||||||
* is reported for this Statement.
|
* is reported for this Statement.
|
||||||
*
|
*
|
||||||
@ -182,7 +182,7 @@ public abstract class Statement
|
|||||||
warnings = null;
|
warnings = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Cancel can be used by one thread to cancel a statement that
|
* Cancel can be used by one thread to cancel a statement that
|
||||||
* is being executed by another thread.
|
* is being executed by another thread.
|
||||||
* <p>
|
* <p>
|
||||||
@ -195,7 +195,7 @@ public abstract class Statement
|
|||||||
// FIXME: Cancel feature has been available since 6.4. Implement it here!
|
// FIXME: Cancel feature has been available since 6.4. Implement it here!
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* New in 7.1: Returns the Last inserted oid. This should be used, rather
|
* New in 7.1: Returns the Last inserted oid. This should be used, rather
|
||||||
* than the old method using getResultSet, which for executeUpdate returns
|
* than the old method using getResultSet, which for executeUpdate returns
|
||||||
* null.
|
* null.
|
||||||
@ -208,7 +208,7 @@ public abstract class Statement
|
|||||||
return ((org.postgresql.ResultSet) result).getInsertedOID();
|
return ((org.postgresql.ResultSet) result).getInsertedOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* getResultSet returns the current result as a ResultSet. It
|
* getResultSet returns the current result as a ResultSet. It
|
||||||
* should only be called once per result.
|
* should only be called once per result.
|
||||||
*
|
*
|
||||||
@ -222,7 +222,7 @@ public abstract class Statement
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* In many cases, it is desirable to immediately release a
|
* In many cases, it is desirable to immediately release a
|
||||||
* Statement's database and JDBC resources instead of waiting
|
* Statement's database and JDBC resources instead of waiting
|
||||||
* for this to happen when it is automatically closed. The
|
* for this to happen when it is automatically closed. The
|
||||||
@ -245,7 +245,7 @@ public abstract class Statement
|
|||||||
result = null;
|
result = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Filter the SQL string of Java SQL Escape clauses.
|
* Filter the SQL string of Java SQL Escape clauses.
|
||||||
*
|
*
|
||||||
* Currently implemented Escape clauses are those mentioned in 11.3
|
* Currently implemented Escape clauses are those mentioned in 11.3
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
package org.postgresql.core;
|
package org.postgresql.core;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A simple and efficient class to pool one dimensional byte arrays
|
* A simple and efficient class to pool one dimensional byte arrays
|
||||||
* of different sizes.
|
* of different sizes.
|
||||||
*/
|
*/
|
||||||
public class BytePoolDim1
|
public class BytePoolDim1
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The maximum size of the array we manage.
|
* The maximum size of the array we manage.
|
||||||
*/
|
*/
|
||||||
int maxsize = 256;
|
int maxsize = 256;
|
||||||
/**
|
/*
|
||||||
* The pools not currently in use
|
* The pools not currently in use
|
||||||
*/
|
*/
|
||||||
ObjectPool notusemap[] = new ObjectPool[maxsize + 1];
|
ObjectPool notusemap[] = new ObjectPool[maxsize + 1];
|
||||||
/**
|
/*
|
||||||
* The pools currently in use
|
* The pools currently in use
|
||||||
*/
|
*/
|
||||||
ObjectPool inusemap[] = new ObjectPool[maxsize + 1];
|
ObjectPool inusemap[] = new ObjectPool[maxsize + 1];
|
||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
byte binit[][] = new byte[maxsize + 1][0];
|
byte binit[][] = new byte[maxsize + 1][0];
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Construct a new pool
|
* Construct a new pool
|
||||||
*/
|
*/
|
||||||
public BytePoolDim1()
|
public BytePoolDim1()
|
||||||
@ -37,7 +37,7 @@ public class BytePoolDim1
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Allocate a byte[] of a specified size and put it in the pool. If it's
|
* Allocate a byte[] of a specified size and put it in the pool. If it's
|
||||||
* larger than maxsize then it is not pooled.
|
* larger than maxsize then it is not pooled.
|
||||||
* @return the byte[] allocated
|
* @return the byte[] allocated
|
||||||
@ -69,7 +69,7 @@ public class BytePoolDim1
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Release an array
|
* Release an array
|
||||||
* @param b byte[] to release
|
* @param b byte[] to release
|
||||||
*/
|
*/
|
||||||
@ -86,7 +86,7 @@ public class BytePoolDim1
|
|||||||
not_usel.add(b);
|
not_usel.add(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Deallocate all
|
* Deallocate all
|
||||||
* @deprecated Real bad things happen if this is called!
|
* @deprecated Real bad things happen if this is called!
|
||||||
*/
|
*/
|
||||||
|
@ -51,7 +51,7 @@ public class BytePoolDim2
|
|||||||
not_usel.add(b);
|
not_usel.add(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Deallocate the object cache.
|
* Deallocate the object cache.
|
||||||
* PM 17/01/01: Commented out this code as it blows away any hope of
|
* PM 17/01/01: Commented out this code as it blows away any hope of
|
||||||
* multiple queries on the same connection. I'll redesign the allocation
|
* multiple queries on the same connection. I'll redesign the allocation
|
||||||
|
@ -5,10 +5,10 @@ import java.util.*;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Converts to and from the character encoding used by the backend.
|
* Converts to and from the character encoding used by the backend.
|
||||||
*
|
*
|
||||||
* $Id: Encoding.java,v 1.3 2001/10/25 05:59:59 momjian Exp $
|
* $Id: Encoding.java,v 1.4 2001/11/19 22:33:37 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Encoding
|
public class Encoding
|
||||||
@ -16,7 +16,7 @@ public class Encoding
|
|||||||
|
|
||||||
private static final Encoding DEFAULT_ENCODING = new Encoding(null);
|
private static final Encoding DEFAULT_ENCODING = new Encoding(null);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Preferred JVM encodings for backend encodings.
|
* Preferred JVM encodings for backend encodings.
|
||||||
*/
|
*/
|
||||||
private static final Hashtable encodings = new Hashtable();
|
private static final Hashtable encodings = new Hashtable();
|
||||||
@ -65,7 +65,7 @@ public class Encoding
|
|||||||
this.encoding = encoding;
|
this.encoding = encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get an Encoding for from the given database encoding and
|
* Get an Encoding for from the given database encoding and
|
||||||
* the encoding passed in by the user.
|
* the encoding passed in by the user.
|
||||||
*/
|
*/
|
||||||
@ -89,7 +89,7 @@ public class Encoding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get an Encoding matching the given database encoding.
|
* Get an Encoding matching the given database encoding.
|
||||||
*/
|
*/
|
||||||
private static Encoding encodingForDatabaseEncoding(String databaseEncoding)
|
private static Encoding encodingForDatabaseEncoding(String databaseEncoding)
|
||||||
@ -112,7 +112,7 @@ public class Encoding
|
|||||||
return defaultEncoding();
|
return defaultEncoding();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Name of the (JVM) encoding used.
|
* Name of the (JVM) encoding used.
|
||||||
*/
|
*/
|
||||||
public String name()
|
public String name()
|
||||||
@ -120,7 +120,7 @@ public class Encoding
|
|||||||
return encoding;
|
return encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Encode a string to an array of bytes.
|
* Encode a string to an array of bytes.
|
||||||
*/
|
*/
|
||||||
public byte[] encode(String s) throws SQLException
|
public byte[] encode(String s) throws SQLException
|
||||||
@ -142,7 +142,7 @@ public class Encoding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Decode an array of bytes into a string.
|
* Decode an array of bytes into a string.
|
||||||
*/
|
*/
|
||||||
public String decode(byte[] encodedString, int offset, int length) throws SQLException
|
public String decode(byte[] encodedString, int offset, int length) throws SQLException
|
||||||
@ -164,7 +164,7 @@ public class Encoding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Decode an array of bytes into a string.
|
* Decode an array of bytes into a string.
|
||||||
*/
|
*/
|
||||||
public String decode(byte[] encodedString) throws SQLException
|
public String decode(byte[] encodedString) throws SQLException
|
||||||
@ -172,7 +172,7 @@ public class Encoding
|
|||||||
return decode(encodedString, 0, encodedString.length);
|
return decode(encodedString, 0, encodedString.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get a Reader that decodes the given InputStream.
|
* Get a Reader that decodes the given InputStream.
|
||||||
*/
|
*/
|
||||||
public Reader getDecodingReader(InputStream in) throws SQLException
|
public Reader getDecodingReader(InputStream in) throws SQLException
|
||||||
@ -194,7 +194,7 @@ public class Encoding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get an Encoding using the default encoding for the JVM.
|
* Get an Encoding using the default encoding for the JVM.
|
||||||
*/
|
*/
|
||||||
public static Encoding defaultEncoding()
|
public static Encoding defaultEncoding()
|
||||||
@ -202,7 +202,7 @@ public class Encoding
|
|||||||
return DEFAULT_ENCODING;
|
return DEFAULT_ENCODING;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test if an encoding is available in the JVM.
|
* Test if an encoding is available in the JVM.
|
||||||
*/
|
*/
|
||||||
private static boolean isAvailable(String encodingName)
|
private static boolean isAvailable(String encodingName)
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
package org.postgresql.core;
|
package org.postgresql.core;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This interface defines the methods to access the memory pool classes.
|
* This interface defines the methods to access the memory pool classes.
|
||||||
*/
|
*/
|
||||||
public interface MemoryPool
|
public interface MemoryPool
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* Allocate an array from the pool
|
* Allocate an array from the pool
|
||||||
* @return byte[] allocated
|
* @return byte[] allocated
|
||||||
*/
|
*/
|
||||||
public byte[] allocByte(int size);
|
public byte[] allocByte(int size);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Frees an object back to the pool
|
* Frees an object back to the pool
|
||||||
* @param o Object to release
|
* @param o Object to release
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package org.postgresql.core;
|
package org.postgresql.core;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This interface defines methods needed to implement a simple object pool.
|
* This interface defines methods needed to implement a simple object pool.
|
||||||
* There are two known classes that implement this, one for jdk1.1 and the
|
* There are two known classes that implement this, one for jdk1.1 and the
|
||||||
* other for jdk1.2+
|
* other for jdk1.2+
|
||||||
@ -8,41 +8,41 @@ package org.postgresql.core;
|
|||||||
|
|
||||||
public interface ObjectPool
|
public interface ObjectPool
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* Adds an object to the pool
|
* Adds an object to the pool
|
||||||
* @param o Object to add
|
* @param o Object to add
|
||||||
*/
|
*/
|
||||||
public void add(Object o);
|
public void add(Object o);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Removes an object from the pool
|
* Removes an object from the pool
|
||||||
* @param o Object to remove
|
* @param o Object to remove
|
||||||
*/
|
*/
|
||||||
public void remove(Object o);
|
public void remove(Object o);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Removes the top object from the pool
|
* Removes the top object from the pool
|
||||||
* @return Object from the top.
|
* @return Object from the top.
|
||||||
*/
|
*/
|
||||||
public Object remove();
|
public Object remove();
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return true if the pool is empty
|
* @return true if the pool is empty
|
||||||
*/
|
*/
|
||||||
public boolean isEmpty();
|
public boolean isEmpty();
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the number of objects in the pool
|
* @return the number of objects in the pool
|
||||||
*/
|
*/
|
||||||
public int size();
|
public int size();
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Adds all objects in one pool to this one
|
* Adds all objects in one pool to this one
|
||||||
* @param pool The pool to take the objects from
|
* @param pool The pool to take the objects from
|
||||||
*/
|
*/
|
||||||
public void addAll(ObjectPool pool);
|
public void addAll(ObjectPool pool);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Clears the pool of all objects
|
* Clears the pool of all objects
|
||||||
*/
|
*/
|
||||||
public void clear();
|
public void clear();
|
||||||
|
@ -7,13 +7,13 @@ import java.sql.*;
|
|||||||
import org.postgresql.*;
|
import org.postgresql.*;
|
||||||
import org.postgresql.util.PSQLException;
|
import org.postgresql.util.PSQLException;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Executes a query on the backend.
|
* Executes a query on the backend.
|
||||||
*
|
*
|
||||||
* <p>The lifetime of a QueryExecutor object is from sending the query
|
* <p>The lifetime of a QueryExecutor object is from sending the query
|
||||||
* until the response has been received from the backend.
|
* until the response has been received from the backend.
|
||||||
*
|
*
|
||||||
* $Id: QueryExecutor.java,v 1.3 2001/10/25 05:59:59 momjian Exp $
|
* $Id: QueryExecutor.java,v 1.4 2001/11/19 22:33:37 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class QueryExecutor
|
public class QueryExecutor
|
||||||
@ -49,7 +49,7 @@ public class QueryExecutor
|
|||||||
private int insert_oid = 0;
|
private int insert_oid = 0;
|
||||||
private int maxRows;
|
private int maxRows;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Execute a query on the backend.
|
* Execute a query on the backend.
|
||||||
*/
|
*/
|
||||||
public java.sql.ResultSet execute() throws SQLException
|
public java.sql.ResultSet execute() throws SQLException
|
||||||
@ -122,7 +122,7 @@ public class QueryExecutor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Send a query to the backend.
|
* Send a query to the backend.
|
||||||
*/
|
*/
|
||||||
private void sendQuery(String query) throws SQLException
|
private void sendQuery(String query) throws SQLException
|
||||||
@ -141,7 +141,7 @@ public class QueryExecutor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Receive a tuple from the backend.
|
* Receive a tuple from the backend.
|
||||||
*
|
*
|
||||||
* @param isBinary set if the tuple should be treated as binary data
|
* @param isBinary set if the tuple should be treated as binary data
|
||||||
@ -157,7 +157,7 @@ public class QueryExecutor
|
|||||||
tuples.addElement(tuple);
|
tuples.addElement(tuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Receive command status from the backend.
|
* Receive command status from the backend.
|
||||||
*/
|
*/
|
||||||
private void receiveCommandStatus() throws SQLException
|
private void receiveCommandStatus() throws SQLException
|
||||||
@ -184,7 +184,7 @@ public class QueryExecutor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Receive the field descriptions from the back end.
|
* Receive the field descriptions from the back end.
|
||||||
*/
|
*/
|
||||||
private void receiveFields() throws SQLException
|
private void receiveFields() throws SQLException
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package org.postgresql.core;
|
package org.postgresql.core;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A simple and fast object pool implementation that can pool objects
|
* A simple and fast object pool implementation that can pool objects
|
||||||
* of any type. This implementation is not thread safe, it is up to the users
|
* of any type. This implementation is not thread safe, it is up to the users
|
||||||
* of this class to assure thread safety.
|
* of this class to assure thread safety.
|
||||||
@ -15,7 +15,7 @@ public class SimpleObjectPool implements ObjectPool
|
|||||||
int maxsize = 16;
|
int maxsize = 16;
|
||||||
Object arr[] = new Object[maxsize];
|
Object arr[] = new Object[maxsize];
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Adds an object to the pool
|
* Adds an object to the pool
|
||||||
* @param o Object to add
|
* @param o Object to add
|
||||||
*/
|
*/
|
||||||
@ -31,7 +31,7 @@ public class SimpleObjectPool implements ObjectPool
|
|||||||
arr[cursize++] = o;
|
arr[cursize++] = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Removes the top object from the pool
|
* Removes the top object from the pool
|
||||||
* @return Object from the top.
|
* @return Object from the top.
|
||||||
*/
|
*/
|
||||||
@ -40,7 +40,7 @@ public class SimpleObjectPool implements ObjectPool
|
|||||||
return arr[--cursize];
|
return arr[--cursize];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Removes the given object from the pool
|
* Removes the given object from the pool
|
||||||
* @param o Object to remove
|
* @param o Object to remove
|
||||||
*/
|
*/
|
||||||
@ -57,7 +57,7 @@ public class SimpleObjectPool implements ObjectPool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return true if the pool is empty
|
* @return true if the pool is empty
|
||||||
*/
|
*/
|
||||||
public boolean isEmpty()
|
public boolean isEmpty()
|
||||||
@ -65,7 +65,7 @@ public class SimpleObjectPool implements ObjectPool
|
|||||||
return cursize == 0;
|
return cursize == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the number of objects in the pool
|
* @return the number of objects in the pool
|
||||||
*/
|
*/
|
||||||
public int size()
|
public int size()
|
||||||
@ -73,7 +73,7 @@ public class SimpleObjectPool implements ObjectPool
|
|||||||
return cursize;
|
return cursize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Adds all objects in one pool to this one
|
* Adds all objects in one pool to this one
|
||||||
* @param pool The pool to take the objects from
|
* @param pool The pool to take the objects from
|
||||||
*/
|
*/
|
||||||
@ -96,7 +96,7 @@ public class SimpleObjectPool implements ObjectPool
|
|||||||
cursize = totalsize;
|
cursize = totalsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Clears the pool of all objects
|
* Clears the pool of all objects
|
||||||
*/
|
*/
|
||||||
public void clear()
|
public void clear()
|
||||||
|
@ -10,7 +10,7 @@ import org.postgresql.util.*;
|
|||||||
// Important: There are a lot of debug code commented out. Please do not
|
// Important: There are a lot of debug code commented out. Please do not
|
||||||
// delete these.
|
// delete these.
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This class implements the Fastpath api.
|
* This class implements the Fastpath api.
|
||||||
*
|
*
|
||||||
* <p>This is a means of executing functions imbeded in the org.postgresql backend
|
* <p>This is a means of executing functions imbeded in the org.postgresql backend
|
||||||
@ -30,7 +30,7 @@ public class Fastpath
|
|||||||
protected org.postgresql.Connection conn; // our connection
|
protected org.postgresql.Connection conn; // our connection
|
||||||
protected org.postgresql.PG_Stream stream; // the network stream
|
protected org.postgresql.PG_Stream stream; // the network stream
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Initialises the fastpath system
|
* Initialises the fastpath system
|
||||||
*
|
*
|
||||||
* <p><b>Important Notice</b>
|
* <p><b>Important Notice</b>
|
||||||
@ -47,7 +47,7 @@ public class Fastpath
|
|||||||
//DriverManager.println("Fastpath initialised");
|
//DriverManager.println("Fastpath initialised");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Send a function call to the PostgreSQL backend
|
* Send a function call to the PostgreSQL backend
|
||||||
*
|
*
|
||||||
* @param fnid Function id
|
* @param fnid Function id
|
||||||
@ -156,7 +156,7 @@ public class Fastpath
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Send a function call to the PostgreSQL backend by name.
|
* Send a function call to the PostgreSQL backend by name.
|
||||||
*
|
*
|
||||||
* Note: the mapping for the procedure name to function id needs to exist,
|
* Note: the mapping for the procedure name to function id needs to exist,
|
||||||
@ -182,7 +182,7 @@ public class Fastpath
|
|||||||
return fastpath(getID(name), resulttype, args);
|
return fastpath(getID(name), resulttype, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This convenience method assumes that the return value is an Integer
|
* This convenience method assumes that the return value is an Integer
|
||||||
* @param name Function name
|
* @param name Function name
|
||||||
* @param args Function arguments
|
* @param args Function arguments
|
||||||
@ -197,7 +197,7 @@ public class Fastpath
|
|||||||
return i.intValue();
|
return i.intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This convenience method assumes that the return value is an Integer
|
* This convenience method assumes that the return value is an Integer
|
||||||
* @param name Function name
|
* @param name Function name
|
||||||
* @param args Function arguments
|
* @param args Function arguments
|
||||||
@ -209,7 +209,7 @@ public class Fastpath
|
|||||||
return (byte[])fastpath(name, false, args);
|
return (byte[])fastpath(name, false, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This adds a function to our lookup table.
|
* This adds a function to our lookup table.
|
||||||
*
|
*
|
||||||
* <p>User code should use the addFunctions method, which is based upon a
|
* <p>User code should use the addFunctions method, which is based upon a
|
||||||
@ -225,7 +225,7 @@ public class Fastpath
|
|||||||
func.put(name, new Integer(fnid));
|
func.put(name, new Integer(fnid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This takes a ResultSet containing two columns. Column 1 contains the
|
* This takes a ResultSet containing two columns. Column 1 contains the
|
||||||
* function name, Column 2 the oid.
|
* function name, Column 2 the oid.
|
||||||
*
|
*
|
||||||
@ -265,7 +265,7 @@ public class Fastpath
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This returns the function id associated by its name
|
* This returns the function id associated by its name
|
||||||
*
|
*
|
||||||
* <p>If addFunction() or addFunctions() have not been called for this name,
|
* <p>If addFunction() or addFunctions() have not been called for this name,
|
||||||
|
@ -7,7 +7,7 @@ import java.util.*;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Each fastpath call requires an array of arguments, the number and type
|
* Each fastpath call requires an array of arguments, the number and type
|
||||||
* dependent on the function being called.
|
* dependent on the function being called.
|
||||||
*
|
*
|
||||||
@ -22,22 +22,22 @@ import org.postgresql.util.*;
|
|||||||
*/
|
*/
|
||||||
public class FastpathArg
|
public class FastpathArg
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* Type of argument, true=integer, false=byte[]
|
* Type of argument, true=integer, false=byte[]
|
||||||
*/
|
*/
|
||||||
public boolean type;
|
public boolean type;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Integer value if type=true
|
* Integer value if type=true
|
||||||
*/
|
*/
|
||||||
public int value;
|
public int value;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Byte value if type=false;
|
* Byte value if type=false;
|
||||||
*/
|
*/
|
||||||
public byte[] bytes;
|
public byte[] bytes;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructs an argument that consists of an integer value
|
* Constructs an argument that consists of an integer value
|
||||||
* @param value int value to set
|
* @param value int value to set
|
||||||
*/
|
*/
|
||||||
@ -47,7 +47,7 @@ public class FastpathArg
|
|||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructs an argument that consists of an array of bytes
|
* Constructs an argument that consists of an array of bytes
|
||||||
* @param bytes array to store
|
* @param bytes array to store
|
||||||
*/
|
*/
|
||||||
@ -57,7 +57,7 @@ public class FastpathArg
|
|||||||
this.bytes = bytes;
|
this.bytes = bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructs an argument that consists of part of a byte array
|
* Constructs an argument that consists of part of a byte array
|
||||||
* @param buf source array
|
* @param buf source array
|
||||||
* @param off offset within array
|
* @param off offset within array
|
||||||
@ -70,7 +70,7 @@ public class FastpathArg
|
|||||||
System.arraycopy(buf, off, bytes, 0, len);
|
System.arraycopy(buf, off, bytes, 0, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructs an argument that consists of a String.
|
* Constructs an argument that consists of a String.
|
||||||
* @param s String to store
|
* @param s String to store
|
||||||
*/
|
*/
|
||||||
@ -79,7 +79,7 @@ public class FastpathArg
|
|||||||
this(s.getBytes());
|
this(s.getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This sends this argument down the network stream.
|
* This sends this argument down the network stream.
|
||||||
*
|
*
|
||||||
* <p>The stream sent consists of the length.int4 then the contents.
|
* <p>The stream sent consists of the length.int4 then the contents.
|
||||||
|
@ -4,17 +4,17 @@ import java.io.*;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This represents the box datatype within org.postgresql.
|
* This represents the box datatype within org.postgresql.
|
||||||
*/
|
*/
|
||||||
public class PGbox extends PGobject implements Serializable, Cloneable
|
public class PGbox extends PGobject implements Serializable, Cloneable
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* These are the two points.
|
* These are the two points.
|
||||||
*/
|
*/
|
||||||
public PGpoint point[] = new PGpoint[2];
|
public PGpoint point[] = new PGpoint[2];
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param x1 first x coordinate
|
* @param x1 first x coordinate
|
||||||
* @param y1 first y coordinate
|
* @param y1 first y coordinate
|
||||||
* @param x2 second x coordinate
|
* @param x2 second x coordinate
|
||||||
@ -27,7 +27,7 @@ public class PGbox extends PGobject implements Serializable, Cloneable
|
|||||||
this.point[1] = new PGpoint(x2, y2);
|
this.point[1] = new PGpoint(x2, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param p1 first point
|
* @param p1 first point
|
||||||
* @param p2 second point
|
* @param p2 second point
|
||||||
*/
|
*/
|
||||||
@ -38,7 +38,7 @@ public class PGbox extends PGobject implements Serializable, Cloneable
|
|||||||
this.point[1] = p2;
|
this.point[1] = p2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param s Box definition in PostgreSQL syntax
|
* @param s Box definition in PostgreSQL syntax
|
||||||
* @exception SQLException if definition is invalid
|
* @exception SQLException if definition is invalid
|
||||||
*/
|
*/
|
||||||
@ -48,7 +48,7 @@ public class PGbox extends PGobject implements Serializable, Cloneable
|
|||||||
setValue(s);
|
setValue(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Required constructor
|
* Required constructor
|
||||||
*/
|
*/
|
||||||
public PGbox()
|
public PGbox()
|
||||||
@ -56,7 +56,7 @@ public class PGbox extends PGobject implements Serializable, Cloneable
|
|||||||
setType("box");
|
setType("box");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This method sets the value of this object. It should be overidden,
|
* This method sets the value of this object. It should be overidden,
|
||||||
* but still called by subclasses.
|
* but still called by subclasses.
|
||||||
*
|
*
|
||||||
@ -73,7 +73,7 @@ public class PGbox extends PGobject implements Serializable, Cloneable
|
|||||||
point[1] = new PGpoint(t.getToken(1));
|
point[1] = new PGpoint(t.getToken(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param obj Object to compare with
|
* @param obj Object to compare with
|
||||||
* @return true if the two boxes are identical
|
* @return true if the two boxes are identical
|
||||||
*/
|
*/
|
||||||
@ -88,7 +88,7 @@ public class PGbox extends PGobject implements Serializable, Cloneable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This must be overidden to allow the object to be cloned
|
* This must be overidden to allow the object to be cloned
|
||||||
*/
|
*/
|
||||||
public Object clone()
|
public Object clone()
|
||||||
@ -96,7 +96,7 @@ public class PGbox extends PGobject implements Serializable, Cloneable
|
|||||||
return new PGbox((PGpoint)point[0].clone(), (PGpoint)point[1].clone());
|
return new PGbox((PGpoint)point[0].clone(), (PGpoint)point[1].clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the PGbox in the syntax expected by org.postgresql
|
* @return the PGbox in the syntax expected by org.postgresql
|
||||||
*/
|
*/
|
||||||
public String getValue()
|
public String getValue()
|
||||||
|
@ -4,23 +4,23 @@ import java.io.*;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This represents org.postgresql's circle datatype, consisting of a point and
|
* This represents org.postgresql's circle datatype, consisting of a point and
|
||||||
* a radius
|
* a radius
|
||||||
*/
|
*/
|
||||||
public class PGcircle extends PGobject implements Serializable, Cloneable
|
public class PGcircle extends PGobject implements Serializable, Cloneable
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* This is the centre point
|
* This is the centre point
|
||||||
*/
|
*/
|
||||||
public PGpoint center;
|
public PGpoint center;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This is the radius
|
* This is the radius
|
||||||
*/
|
*/
|
||||||
double radius;
|
double radius;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param x coordinate of centre
|
* @param x coordinate of centre
|
||||||
* @param y coordinate of centre
|
* @param y coordinate of centre
|
||||||
* @param r radius of circle
|
* @param r radius of circle
|
||||||
@ -30,7 +30,7 @@ public class PGcircle extends PGobject implements Serializable, Cloneable
|
|||||||
this(new PGpoint(x, y), r);
|
this(new PGpoint(x, y), r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param c PGpoint describing the circle's centre
|
* @param c PGpoint describing the circle's centre
|
||||||
* @param r radius of circle
|
* @param r radius of circle
|
||||||
*/
|
*/
|
||||||
@ -41,7 +41,7 @@ public class PGcircle extends PGobject implements Serializable, Cloneable
|
|||||||
this.radius = r;
|
this.radius = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param s definition of the circle in PostgreSQL's syntax.
|
* @param s definition of the circle in PostgreSQL's syntax.
|
||||||
* @exception SQLException on conversion failure
|
* @exception SQLException on conversion failure
|
||||||
*/
|
*/
|
||||||
@ -51,7 +51,7 @@ public class PGcircle extends PGobject implements Serializable, Cloneable
|
|||||||
setValue(s);
|
setValue(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This constructor is used by the driver.
|
* This constructor is used by the driver.
|
||||||
*/
|
*/
|
||||||
public PGcircle()
|
public PGcircle()
|
||||||
@ -59,7 +59,7 @@ public class PGcircle extends PGobject implements Serializable, Cloneable
|
|||||||
setType("circle");
|
setType("circle");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param s definition of the circle in PostgreSQL's syntax.
|
* @param s definition of the circle in PostgreSQL's syntax.
|
||||||
* @exception SQLException on conversion failure
|
* @exception SQLException on conversion failure
|
||||||
*/
|
*/
|
||||||
@ -80,7 +80,7 @@ public class PGcircle extends PGobject implements Serializable, Cloneable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param obj Object to compare with
|
* @param obj Object to compare with
|
||||||
* @return true if the two boxes are identical
|
* @return true if the two boxes are identical
|
||||||
*/
|
*/
|
||||||
@ -94,7 +94,7 @@ public class PGcircle extends PGobject implements Serializable, Cloneable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This must be overidden to allow the object to be cloned
|
* This must be overidden to allow the object to be cloned
|
||||||
*/
|
*/
|
||||||
public Object clone()
|
public Object clone()
|
||||||
@ -102,7 +102,7 @@ public class PGcircle extends PGobject implements Serializable, Cloneable
|
|||||||
return new PGcircle((PGpoint)center.clone(), radius);
|
return new PGcircle((PGpoint)center.clone(), radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the PGcircle in the syntax expected by org.postgresql
|
* @return the PGcircle in the syntax expected by org.postgresql
|
||||||
*/
|
*/
|
||||||
public String getValue()
|
public String getValue()
|
||||||
|
@ -4,7 +4,7 @@ import java.io.*;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This implements a line consisting of two points.
|
* This implements a line consisting of two points.
|
||||||
*
|
*
|
||||||
* Currently line is not yet implemented in the backend, but this class
|
* Currently line is not yet implemented in the backend, but this class
|
||||||
@ -12,12 +12,12 @@ import org.postgresql.util.*;
|
|||||||
*/
|
*/
|
||||||
public class PGline extends PGobject implements Serializable, Cloneable
|
public class PGline extends PGobject implements Serializable, Cloneable
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* These are the two points.
|
* These are the two points.
|
||||||
*/
|
*/
|
||||||
public PGpoint point[] = new PGpoint[2];
|
public PGpoint point[] = new PGpoint[2];
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param x1 coordinate for first point
|
* @param x1 coordinate for first point
|
||||||
* @param y1 coordinate for first point
|
* @param y1 coordinate for first point
|
||||||
* @param x2 coordinate for second point
|
* @param x2 coordinate for second point
|
||||||
@ -28,7 +28,7 @@ public class PGline extends PGobject implements Serializable, Cloneable
|
|||||||
this(new PGpoint(x1, y1), new PGpoint(x2, y2));
|
this(new PGpoint(x1, y1), new PGpoint(x2, y2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param p1 first point
|
* @param p1 first point
|
||||||
* @param p2 second point
|
* @param p2 second point
|
||||||
*/
|
*/
|
||||||
@ -39,7 +39,7 @@ public class PGline extends PGobject implements Serializable, Cloneable
|
|||||||
this.point[1] = p2;
|
this.point[1] = p2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param s definition of the circle in PostgreSQL's syntax.
|
* @param s definition of the circle in PostgreSQL's syntax.
|
||||||
* @exception SQLException on conversion failure
|
* @exception SQLException on conversion failure
|
||||||
*/
|
*/
|
||||||
@ -49,7 +49,7 @@ public class PGline extends PGobject implements Serializable, Cloneable
|
|||||||
setValue(s);
|
setValue(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* reuired by the driver
|
* reuired by the driver
|
||||||
*/
|
*/
|
||||||
public PGline()
|
public PGline()
|
||||||
@ -57,7 +57,7 @@ public class PGline extends PGobject implements Serializable, Cloneable
|
|||||||
setType("line");
|
setType("line");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param s Definition of the line segment in PostgreSQL's syntax
|
* @param s Definition of the line segment in PostgreSQL's syntax
|
||||||
* @exception SQLException on conversion failure
|
* @exception SQLException on conversion failure
|
||||||
*/
|
*/
|
||||||
@ -71,7 +71,7 @@ public class PGline extends PGobject implements Serializable, Cloneable
|
|||||||
point[1] = new PGpoint(t.getToken(1));
|
point[1] = new PGpoint(t.getToken(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param obj Object to compare with
|
* @param obj Object to compare with
|
||||||
* @return true if the two boxes are identical
|
* @return true if the two boxes are identical
|
||||||
*/
|
*/
|
||||||
@ -86,7 +86,7 @@ public class PGline extends PGobject implements Serializable, Cloneable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This must be overidden to allow the object to be cloned
|
* This must be overidden to allow the object to be cloned
|
||||||
*/
|
*/
|
||||||
public Object clone()
|
public Object clone()
|
||||||
@ -94,7 +94,7 @@ public class PGline extends PGobject implements Serializable, Cloneable
|
|||||||
return new PGline((PGpoint)point[0].clone(), (PGpoint)point[1].clone());
|
return new PGline((PGpoint)point[0].clone(), (PGpoint)point[1].clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the PGline in the syntax expected by org.postgresql
|
* @return the PGline in the syntax expected by org.postgresql
|
||||||
*/
|
*/
|
||||||
public String getValue()
|
public String getValue()
|
||||||
|
@ -4,17 +4,17 @@ import java.io.*;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This implements a lseg (line segment) consisting of two points
|
* This implements a lseg (line segment) consisting of two points
|
||||||
*/
|
*/
|
||||||
public class PGlseg extends PGobject implements Serializable, Cloneable
|
public class PGlseg extends PGobject implements Serializable, Cloneable
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* These are the two points.
|
* These are the two points.
|
||||||
*/
|
*/
|
||||||
public PGpoint point[] = new PGpoint[2];
|
public PGpoint point[] = new PGpoint[2];
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param x1 coordinate for first point
|
* @param x1 coordinate for first point
|
||||||
* @param y1 coordinate for first point
|
* @param y1 coordinate for first point
|
||||||
* @param x2 coordinate for second point
|
* @param x2 coordinate for second point
|
||||||
@ -25,7 +25,7 @@ public class PGlseg extends PGobject implements Serializable, Cloneable
|
|||||||
this(new PGpoint(x1, y1), new PGpoint(x2, y2));
|
this(new PGpoint(x1, y1), new PGpoint(x2, y2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param p1 first point
|
* @param p1 first point
|
||||||
* @param p2 second point
|
* @param p2 second point
|
||||||
*/
|
*/
|
||||||
@ -36,7 +36,7 @@ public class PGlseg extends PGobject implements Serializable, Cloneable
|
|||||||
this.point[1] = p2;
|
this.point[1] = p2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param s definition of the circle in PostgreSQL's syntax.
|
* @param s definition of the circle in PostgreSQL's syntax.
|
||||||
* @exception SQLException on conversion failure
|
* @exception SQLException on conversion failure
|
||||||
*/
|
*/
|
||||||
@ -46,7 +46,7 @@ public class PGlseg extends PGobject implements Serializable, Cloneable
|
|||||||
setValue(s);
|
setValue(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* reuired by the driver
|
* reuired by the driver
|
||||||
*/
|
*/
|
||||||
public PGlseg()
|
public PGlseg()
|
||||||
@ -54,7 +54,7 @@ public class PGlseg extends PGobject implements Serializable, Cloneable
|
|||||||
setType("lseg");
|
setType("lseg");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param s Definition of the line segment in PostgreSQL's syntax
|
* @param s Definition of the line segment in PostgreSQL's syntax
|
||||||
* @exception SQLException on conversion failure
|
* @exception SQLException on conversion failure
|
||||||
*/
|
*/
|
||||||
@ -68,7 +68,7 @@ public class PGlseg extends PGobject implements Serializable, Cloneable
|
|||||||
point[1] = new PGpoint(t.getToken(1));
|
point[1] = new PGpoint(t.getToken(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param obj Object to compare with
|
* @param obj Object to compare with
|
||||||
* @return true if the two boxes are identical
|
* @return true if the two boxes are identical
|
||||||
*/
|
*/
|
||||||
@ -83,7 +83,7 @@ public class PGlseg extends PGobject implements Serializable, Cloneable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This must be overidden to allow the object to be cloned
|
* This must be overidden to allow the object to be cloned
|
||||||
*/
|
*/
|
||||||
public Object clone()
|
public Object clone()
|
||||||
@ -91,7 +91,7 @@ public class PGlseg extends PGobject implements Serializable, Cloneable
|
|||||||
return new PGlseg((PGpoint)point[0].clone(), (PGpoint)point[1].clone());
|
return new PGlseg((PGpoint)point[0].clone(), (PGpoint)point[1].clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the PGlseg in the syntax expected by org.postgresql
|
* @return the PGlseg in the syntax expected by org.postgresql
|
||||||
*/
|
*/
|
||||||
public String getValue()
|
public String getValue()
|
||||||
|
@ -4,22 +4,22 @@ import java.io.*;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This implements a path (a multiple segmented line, which may be closed)
|
* This implements a path (a multiple segmented line, which may be closed)
|
||||||
*/
|
*/
|
||||||
public class PGpath extends PGobject implements Serializable, Cloneable
|
public class PGpath extends PGobject implements Serializable, Cloneable
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* True if the path is open, false if closed
|
* True if the path is open, false if closed
|
||||||
*/
|
*/
|
||||||
public boolean open;
|
public boolean open;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The points defining this path
|
* The points defining this path
|
||||||
*/
|
*/
|
||||||
public PGpoint points[];
|
public PGpoint points[];
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param points the PGpoints that define the path
|
* @param points the PGpoints that define the path
|
||||||
* @param open True if the path is open, false if closed
|
* @param open True if the path is open, false if closed
|
||||||
*/
|
*/
|
||||||
@ -30,7 +30,7 @@ public class PGpath extends PGobject implements Serializable, Cloneable
|
|||||||
this.open = open;
|
this.open = open;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Required by the driver
|
* Required by the driver
|
||||||
*/
|
*/
|
||||||
public PGpath()
|
public PGpath()
|
||||||
@ -38,7 +38,7 @@ public class PGpath extends PGobject implements Serializable, Cloneable
|
|||||||
setType("path");
|
setType("path");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param s definition of the circle in PostgreSQL's syntax.
|
* @param s definition of the circle in PostgreSQL's syntax.
|
||||||
* @exception SQLException on conversion failure
|
* @exception SQLException on conversion failure
|
||||||
*/
|
*/
|
||||||
@ -48,7 +48,7 @@ public class PGpath extends PGobject implements Serializable, Cloneable
|
|||||||
setValue(s);
|
setValue(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param s Definition of the path in PostgreSQL's syntax
|
* @param s Definition of the path in PostgreSQL's syntax
|
||||||
* @exception SQLException on conversion failure
|
* @exception SQLException on conversion failure
|
||||||
*/
|
*/
|
||||||
@ -75,7 +75,7 @@ public class PGpath extends PGobject implements Serializable, Cloneable
|
|||||||
points[p] = new PGpoint(t.getToken(p));
|
points[p] = new PGpoint(t.getToken(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param obj Object to compare with
|
* @param obj Object to compare with
|
||||||
* @return true if the two boxes are identical
|
* @return true if the two boxes are identical
|
||||||
*/
|
*/
|
||||||
@ -100,7 +100,7 @@ public class PGpath extends PGobject implements Serializable, Cloneable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This must be overidden to allow the object to be cloned
|
* This must be overidden to allow the object to be cloned
|
||||||
*/
|
*/
|
||||||
public Object clone()
|
public Object clone()
|
||||||
@ -111,7 +111,7 @@ public class PGpath extends PGobject implements Serializable, Cloneable
|
|||||||
return new PGpath(ary, open);
|
return new PGpath(ary, open);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This returns the polygon in the syntax expected by org.postgresql
|
* This returns the polygon in the syntax expected by org.postgresql
|
||||||
*/
|
*/
|
||||||
public String getValue()
|
public String getValue()
|
||||||
|
@ -6,7 +6,7 @@ import java.sql.*;
|
|||||||
|
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This implements a version of java.awt.Point, except it uses double
|
* This implements a version of java.awt.Point, except it uses double
|
||||||
* to represent the coordinates.
|
* to represent the coordinates.
|
||||||
*
|
*
|
||||||
@ -14,17 +14,17 @@ import org.postgresql.util.*;
|
|||||||
*/
|
*/
|
||||||
public class PGpoint extends PGobject implements Serializable, Cloneable
|
public class PGpoint extends PGobject implements Serializable, Cloneable
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* The X coordinate of the point
|
* The X coordinate of the point
|
||||||
*/
|
*/
|
||||||
public double x;
|
public double x;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The Y coordinate of the point
|
* The Y coordinate of the point
|
||||||
*/
|
*/
|
||||||
public double y;
|
public double y;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param x coordinate
|
* @param x coordinate
|
||||||
* @param y coordinate
|
* @param y coordinate
|
||||||
*/
|
*/
|
||||||
@ -35,7 +35,7 @@ public class PGpoint extends PGobject implements Serializable, Cloneable
|
|||||||
this.y = y;
|
this.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This is called mainly from the other geometric types, when a
|
* This is called mainly from the other geometric types, when a
|
||||||
* point is imbeded within their definition.
|
* point is imbeded within their definition.
|
||||||
*
|
*
|
||||||
@ -47,7 +47,7 @@ public class PGpoint extends PGobject implements Serializable, Cloneable
|
|||||||
setValue(value);
|
setValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Required by the driver
|
* Required by the driver
|
||||||
*/
|
*/
|
||||||
public PGpoint()
|
public PGpoint()
|
||||||
@ -55,7 +55,7 @@ public class PGpoint extends PGobject implements Serializable, Cloneable
|
|||||||
setType("point");
|
setType("point");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param s Definition of this point in PostgreSQL's syntax
|
* @param s Definition of this point in PostgreSQL's syntax
|
||||||
* @exception SQLException on conversion failure
|
* @exception SQLException on conversion failure
|
||||||
*/
|
*/
|
||||||
@ -73,7 +73,7 @@ public class PGpoint extends PGobject implements Serializable, Cloneable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param obj Object to compare with
|
* @param obj Object to compare with
|
||||||
* @return true if the two boxes are identical
|
* @return true if the two boxes are identical
|
||||||
*/
|
*/
|
||||||
@ -87,7 +87,7 @@ public class PGpoint extends PGobject implements Serializable, Cloneable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This must be overidden to allow the object to be cloned
|
* This must be overidden to allow the object to be cloned
|
||||||
*/
|
*/
|
||||||
public Object clone()
|
public Object clone()
|
||||||
@ -95,7 +95,7 @@ public class PGpoint extends PGobject implements Serializable, Cloneable
|
|||||||
return new PGpoint(x, y);
|
return new PGpoint(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the PGpoint in the syntax expected by org.postgresql
|
* @return the PGpoint in the syntax expected by org.postgresql
|
||||||
*/
|
*/
|
||||||
public String getValue()
|
public String getValue()
|
||||||
@ -103,7 +103,7 @@ public class PGpoint extends PGobject implements Serializable, Cloneable
|
|||||||
return "(" + x + "," + y + ")";
|
return "(" + x + "," + y + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Translate the point with the supplied amount.
|
* Translate the point with the supplied amount.
|
||||||
* @param x integer amount to add on the x axis
|
* @param x integer amount to add on the x axis
|
||||||
* @param y integer amount to add on the y axis
|
* @param y integer amount to add on the y axis
|
||||||
@ -113,7 +113,7 @@ public class PGpoint extends PGobject implements Serializable, Cloneable
|
|||||||
translate((double)x, (double)y);
|
translate((double)x, (double)y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Translate the point with the supplied amount.
|
* Translate the point with the supplied amount.
|
||||||
* @param x double amount to add on the x axis
|
* @param x double amount to add on the x axis
|
||||||
* @param y double amount to add on the y axis
|
* @param y double amount to add on the y axis
|
||||||
@ -124,7 +124,7 @@ public class PGpoint extends PGobject implements Serializable, Cloneable
|
|||||||
this.y += y;
|
this.y += y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Moves the point to the supplied coordinates.
|
* Moves the point to the supplied coordinates.
|
||||||
* @param x integer coordinate
|
* @param x integer coordinate
|
||||||
* @param y integer coordinate
|
* @param y integer coordinate
|
||||||
@ -134,7 +134,7 @@ public class PGpoint extends PGobject implements Serializable, Cloneable
|
|||||||
setLocation(x, y);
|
setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Moves the point to the supplied coordinates.
|
* Moves the point to the supplied coordinates.
|
||||||
* @param x double coordinate
|
* @param x double coordinate
|
||||||
* @param y double coordinate
|
* @param y double coordinate
|
||||||
@ -145,7 +145,7 @@ public class PGpoint extends PGobject implements Serializable, Cloneable
|
|||||||
this.y = y;
|
this.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Moves the point to the supplied coordinates.
|
* Moves the point to the supplied coordinates.
|
||||||
* refer to java.awt.Point for description of this
|
* refer to java.awt.Point for description of this
|
||||||
* @param x integer coordinate
|
* @param x integer coordinate
|
||||||
@ -157,7 +157,7 @@ public class PGpoint extends PGobject implements Serializable, Cloneable
|
|||||||
move((double)x, (double)y);
|
move((double)x, (double)y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Moves the point to the supplied java.awt.Point
|
* Moves the point to the supplied java.awt.Point
|
||||||
* refer to java.awt.Point for description of this
|
* refer to java.awt.Point for description of this
|
||||||
* @param p Point to move to
|
* @param p Point to move to
|
||||||
|
@ -4,17 +4,17 @@ import java.io.*;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This implements the polygon datatype within PostgreSQL.
|
* This implements the polygon datatype within PostgreSQL.
|
||||||
*/
|
*/
|
||||||
public class PGpolygon extends PGobject implements Serializable, Cloneable
|
public class PGpolygon extends PGobject implements Serializable, Cloneable
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* The points defining the polygon
|
* The points defining the polygon
|
||||||
*/
|
*/
|
||||||
public PGpoint points[];
|
public PGpoint points[];
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Creates a polygon using an array of PGpoints
|
* Creates a polygon using an array of PGpoints
|
||||||
*
|
*
|
||||||
* @param points the points defining the polygon
|
* @param points the points defining the polygon
|
||||||
@ -25,7 +25,7 @@ public class PGpolygon extends PGobject implements Serializable, Cloneable
|
|||||||
this.points = points;
|
this.points = points;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param s definition of the circle in PostgreSQL's syntax.
|
* @param s definition of the circle in PostgreSQL's syntax.
|
||||||
* @exception SQLException on conversion failure
|
* @exception SQLException on conversion failure
|
||||||
*/
|
*/
|
||||||
@ -35,7 +35,7 @@ public class PGpolygon extends PGobject implements Serializable, Cloneable
|
|||||||
setValue(s);
|
setValue(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Required by the driver
|
* Required by the driver
|
||||||
*/
|
*/
|
||||||
public PGpolygon()
|
public PGpolygon()
|
||||||
@ -43,7 +43,7 @@ public class PGpolygon extends PGobject implements Serializable, Cloneable
|
|||||||
setType("polygon");
|
setType("polygon");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param s Definition of the polygon in PostgreSQL's syntax
|
* @param s Definition of the polygon in PostgreSQL's syntax
|
||||||
* @exception SQLException on conversion failure
|
* @exception SQLException on conversion failure
|
||||||
*/
|
*/
|
||||||
@ -56,7 +56,7 @@ public class PGpolygon extends PGobject implements Serializable, Cloneable
|
|||||||
points[p] = new PGpoint(t.getToken(p));
|
points[p] = new PGpoint(t.getToken(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param obj Object to compare with
|
* @param obj Object to compare with
|
||||||
* @return true if the two boxes are identical
|
* @return true if the two boxes are identical
|
||||||
*/
|
*/
|
||||||
@ -78,7 +78,7 @@ public class PGpolygon extends PGobject implements Serializable, Cloneable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This must be overidden to allow the object to be cloned
|
* This must be overidden to allow the object to be cloned
|
||||||
*/
|
*/
|
||||||
public Object clone()
|
public Object clone()
|
||||||
@ -89,7 +89,7 @@ public class PGpolygon extends PGobject implements Serializable, Cloneable
|
|||||||
return new PGpolygon(ary);
|
return new PGpolygon(ary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the PGpolygon in the syntax expected by org.postgresql
|
* @return the PGpolygon in the syntax expected by org.postgresql
|
||||||
*/
|
*/
|
||||||
public String getValue()
|
public String getValue()
|
||||||
|
@ -8,7 +8,7 @@ package org.postgresql.jdbc1;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.math.*;
|
import java.math.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* CallableStatement is used to execute SQL stored procedures.
|
* CallableStatement is used to execute SQL stored procedures.
|
||||||
*
|
*
|
||||||
* <p>JDBC provides a stored procedure SQL escape that allows stored
|
* <p>JDBC provides a stored procedure SQL escape that allows stored
|
||||||
@ -41,7 +41,7 @@ import java.math.*;
|
|||||||
|
|
||||||
public class CallableStatement extends PreparedStatement implements java.sql.CallableStatement
|
public class CallableStatement extends PreparedStatement implements java.sql.CallableStatement
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* @exception SQLException on failure
|
* @exception SQLException on failure
|
||||||
*/
|
*/
|
||||||
CallableStatement(Connection c, String q) throws SQLException
|
CallableStatement(Connection c, String q) throws SQLException
|
||||||
@ -49,7 +49,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
super(c, q);
|
super(c, q);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Before executing a stored procedure call you must explicitly
|
* Before executing a stored procedure call you must explicitly
|
||||||
* call registerOutParameter to register the java.sql.Type of each
|
* call registerOutParameter to register the java.sql.Type of each
|
||||||
* out parameter.
|
* out parameter.
|
||||||
@ -67,7 +67,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
|
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* You must also specify the scale for numeric/decimal types:
|
* You must also specify the scale for numeric/decimal types:
|
||||||
*
|
*
|
||||||
* <p>Note: When reading the value of an out parameter, you must use
|
* <p>Note: When reading the value of an out parameter, you must use
|
||||||
@ -89,7 +89,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
//return true;
|
//return true;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* An OUT parameter may have the value of SQL NULL; wasNull
|
* An OUT parameter may have the value of SQL NULL; wasNull
|
||||||
* reports whether the last value read has this special value.
|
* reports whether the last value read has this special value.
|
||||||
*
|
*
|
||||||
@ -109,7 +109,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
//return null;
|
//return null;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a CHAR, VARCHAR, or LONGVARCHAR parameter as a
|
* Get the value of a CHAR, VARCHAR, or LONGVARCHAR parameter as a
|
||||||
* Java String.
|
* Java String.
|
||||||
*
|
*
|
||||||
@ -129,7 +129,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
//return null;
|
//return null;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a BIT parameter as a Java boolean.
|
* Get the value of a BIT parameter as a Java boolean.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -141,7 +141,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a TINYINT parameter as a Java byte.
|
* Get the value of a TINYINT parameter as a Java byte.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -153,7 +153,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a SMALLINT parameter as a Java short.
|
* Get the value of a SMALLINT parameter as a Java short.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -165,7 +165,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of an INTEGER parameter as a Java int.
|
* Get the value of an INTEGER parameter as a Java int.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -177,7 +177,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a BIGINT parameter as a Java long.
|
* Get the value of a BIGINT parameter as a Java long.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -189,7 +189,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a FLOAT parameter as a Java float.
|
* Get the value of a FLOAT parameter as a Java float.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -201,7 +201,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
return (float) 0.0;
|
return (float) 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a DOUBLE parameter as a Java double.
|
* Get the value of a DOUBLE parameter as a Java double.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -213,7 +213,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a NUMERIC parameter as a java.math.BigDecimal
|
* Get the value of a NUMERIC parameter as a java.math.BigDecimal
|
||||||
* object.
|
* object.
|
||||||
*
|
*
|
||||||
@ -229,7 +229,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a SQL BINARY or VARBINARY parameter as a Java
|
* Get the value of a SQL BINARY or VARBINARY parameter as a Java
|
||||||
* byte[]
|
* byte[]
|
||||||
*
|
*
|
||||||
@ -247,7 +247,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
//return null;
|
//return null;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a SQL DATE parameter as a java.sql.Date object
|
* Get the value of a SQL DATE parameter as a java.sql.Date object
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -259,7 +259,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a SQL TIME parameter as a java.sql.Time object.
|
* Get the value of a SQL TIME parameter as a java.sql.Time object.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -271,7 +271,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a SQL TIMESTAMP parameter as a java.sql.Timestamp object.
|
* Get the value of a SQL TIMESTAMP parameter as a java.sql.Timestamp object.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -295,7 +295,7 @@ public class CallableStatement extends PreparedStatement implements java.sql.Cal
|
|||||||
|
|
||||||
// getObject returns a Java object for the parameter.
|
// getObject returns a Java object for the parameter.
|
||||||
// See the JDBC spec's "Dynamic Programming" chapter for details.
|
// See the JDBC spec's "Dynamic Programming" chapter for details.
|
||||||
/**
|
/*
|
||||||
* Get the value of a parameter as a Java object.
|
* Get the value of a parameter as a Java object.
|
||||||
*
|
*
|
||||||
* <p>This method returns a Java object whose type coresponds to the
|
* <p>This method returns a Java object whose type coresponds to the
|
||||||
|
@ -16,8 +16,8 @@ import org.postgresql.fastpath.*;
|
|||||||
import org.postgresql.largeobject.*;
|
import org.postgresql.largeobject.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* $Id: Connection.java,v 1.12 2001/10/25 05:59:59 momjian Exp $
|
* $Id: Connection.java,v 1.13 2001/11/19 22:33:38 momjian Exp $
|
||||||
*
|
*
|
||||||
* A Connection represents a session with a specific database. Within the
|
* A Connection represents a session with a specific database. Within the
|
||||||
* context of a Connection, SQL statements are executed and results are
|
* context of a Connection, SQL statements are executed and results are
|
||||||
@ -39,7 +39,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
// This is a cache of the DatabaseMetaData instance for this connection
|
// This is a cache of the DatabaseMetaData instance for this connection
|
||||||
protected DatabaseMetaData metadata;
|
protected DatabaseMetaData metadata;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* SQL statements without parameters are normally executed using
|
* SQL statements without parameters are normally executed using
|
||||||
* Statement objects. If the same SQL statement is executed many
|
* Statement objects. If the same SQL statement is executed many
|
||||||
* times, it is more efficient to use a PreparedStatement
|
* times, it is more efficient to use a PreparedStatement
|
||||||
@ -52,7 +52,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
return new Statement(this);
|
return new Statement(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A SQL statement with or without IN parameters can be pre-compiled
|
* A SQL statement with or without IN parameters can be pre-compiled
|
||||||
* and stored in a PreparedStatement object. This object can then
|
* and stored in a PreparedStatement object. This object can then
|
||||||
* be used to efficiently execute this statement multiple times.
|
* be used to efficiently execute this statement multiple times.
|
||||||
@ -75,7 +75,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
return new PreparedStatement(this, sql);
|
return new PreparedStatement(this, sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A SQL stored procedure call statement is handled by creating a
|
* A SQL stored procedure call statement is handled by creating a
|
||||||
* CallableStatement for it. The CallableStatement provides methods
|
* CallableStatement for it. The CallableStatement provides methods
|
||||||
* for setting up its IN and OUT parameters and methods for executing
|
* for setting up its IN and OUT parameters and methods for executing
|
||||||
@ -100,7 +100,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
// return new CallableStatement(this, sql);
|
// return new CallableStatement(this, sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests to see if a Connection is closed
|
* Tests to see if a Connection is closed
|
||||||
*
|
*
|
||||||
* @return the status of the connection
|
* @return the status of the connection
|
||||||
@ -111,7 +111,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
return (pg_stream == null);
|
return (pg_stream == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A connection's database is able to provide information describing
|
* A connection's database is able to provide information describing
|
||||||
* its tables, its supported SQL grammar, its stored procedures, the
|
* its tables, its supported SQL grammar, its stored procedures, the
|
||||||
* capabilities of this connection, etc. This information is made
|
* capabilities of this connection, etc. This information is made
|
||||||
@ -127,7 +127,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This overides the method in org.postgresql.Connection and returns a
|
* This overides the method in org.postgresql.Connection and returns a
|
||||||
* ResultSet.
|
* ResultSet.
|
||||||
*/
|
*/
|
||||||
@ -157,7 +157,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
return sqlType;
|
return sqlType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This table holds the org.postgresql names for the types supported.
|
* This table holds the org.postgresql names for the types supported.
|
||||||
* Any types that map to Types.OTHER (eg POINT) don't go into this table.
|
* Any types that map to Types.OTHER (eg POINT) don't go into this table.
|
||||||
* They default automatically to Types.OTHER
|
* They default automatically to Types.OTHER
|
||||||
@ -183,7 +183,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
"abstime", "timestamp"
|
"abstime", "timestamp"
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This table holds the JDBC type for each entry above.
|
* This table holds the JDBC type for each entry above.
|
||||||
*
|
*
|
||||||
* Note: This must be in the same order as above
|
* Note: This must be in the same order as above
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -13,7 +13,7 @@ import java.util.*;
|
|||||||
import org.postgresql.largeobject.*;
|
import org.postgresql.largeobject.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A SQL Statement is pre-compiled and stored in a PreparedStatement object.
|
* A SQL Statement is pre-compiled and stored in a PreparedStatement object.
|
||||||
* This object can then be used to efficiently execute this statement multiple
|
* This object can then be used to efficiently execute this statement multiple
|
||||||
* times.
|
* times.
|
||||||
@ -36,7 +36,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
String[] inStrings;
|
String[] inStrings;
|
||||||
Connection connection;
|
Connection connection;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructor for the PreparedStatement class.
|
* Constructor for the PreparedStatement class.
|
||||||
* Split the SQL statement into segments - separated by the arguments.
|
* Split the SQL statement into segments - separated by the arguments.
|
||||||
* When we rebuild the thing with the arguments, we can substitute the
|
* When we rebuild the thing with the arguments, we can substitute the
|
||||||
@ -78,7 +78,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
templateStrings[i] = (String)v.elementAt(i);
|
templateStrings[i] = (String)v.elementAt(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A Prepared SQL query is executed and its ResultSet is returned
|
* A Prepared SQL query is executed and its ResultSet is returned
|
||||||
*
|
*
|
||||||
* @return a ResultSet that contains the data produced by the
|
* @return a ResultSet that contains the data produced by the
|
||||||
@ -101,7 +101,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
return super.executeQuery(s.toString()); // in Statement class
|
return super.executeQuery(s.toString()); // in Statement class
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Execute a SQL INSERT, UPDATE or DELETE statement. In addition,
|
* Execute a SQL INSERT, UPDATE or DELETE statement. In addition,
|
||||||
* SQL statements that return nothing such as SQL DDL statements can
|
* SQL statements that return nothing such as SQL DDL statements can
|
||||||
* be executed.
|
* be executed.
|
||||||
@ -126,7 +126,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
return super.executeUpdate(s.toString()); // in Statement class
|
return super.executeUpdate(s.toString()); // in Statement class
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to SQL NULL
|
* Set a parameter to SQL NULL
|
||||||
*
|
*
|
||||||
* <p><B>Note:</B> You must specify the parameters SQL type (although
|
* <p><B>Note:</B> You must specify the parameters SQL type (although
|
||||||
@ -141,7 +141,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, "null");
|
set(parameterIndex, "null");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java boolean value. The driver converts this
|
* Set a parameter to a Java boolean value. The driver converts this
|
||||||
* to a SQL BIT value when it sends it to the database.
|
* to a SQL BIT value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -154,7 +154,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, x ? "'t'" : "'f'");
|
set(parameterIndex, x ? "'t'" : "'f'");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java byte value. The driver converts this to
|
* Set a parameter to a Java byte value. The driver converts this to
|
||||||
* a SQL TINYINT value when it sends it to the database.
|
* a SQL TINYINT value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -167,7 +167,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, Integer.toString(x));
|
set(parameterIndex, Integer.toString(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java short value. The driver converts this
|
* Set a parameter to a Java short value. The driver converts this
|
||||||
* to a SQL SMALLINT value when it sends it to the database.
|
* to a SQL SMALLINT value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -180,7 +180,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, Integer.toString(x));
|
set(parameterIndex, Integer.toString(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java int value. The driver converts this to
|
* Set a parameter to a Java int value. The driver converts this to
|
||||||
* a SQL INTEGER value when it sends it to the database.
|
* a SQL INTEGER value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -193,7 +193,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, Integer.toString(x));
|
set(parameterIndex, Integer.toString(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java long value. The driver converts this to
|
* Set a parameter to a Java long value. The driver converts this to
|
||||||
* a SQL BIGINT value when it sends it to the database.
|
* a SQL BIGINT value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -206,7 +206,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, Long.toString(x));
|
set(parameterIndex, Long.toString(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java float value. The driver converts this
|
* Set a parameter to a Java float value. The driver converts this
|
||||||
* to a SQL FLOAT value when it sends it to the database.
|
* to a SQL FLOAT value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -219,7 +219,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, Float.toString(x));
|
set(parameterIndex, Float.toString(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java double value. The driver converts this
|
* Set a parameter to a Java double value. The driver converts this
|
||||||
* to a SQL DOUBLE value when it sends it to the database
|
* to a SQL DOUBLE value when it sends it to the database
|
||||||
*
|
*
|
||||||
@ -232,7 +232,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, Double.toString(x));
|
set(parameterIndex, Double.toString(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a java.lang.BigDecimal value. The driver
|
* Set a parameter to a java.lang.BigDecimal value. The driver
|
||||||
* converts this to a SQL NUMERIC value when it sends it to the
|
* converts this to a SQL NUMERIC value when it sends it to the
|
||||||
* database.
|
* database.
|
||||||
@ -246,7 +246,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, x.toString());
|
set(parameterIndex, x.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java String value. The driver converts this
|
* Set a parameter to a Java String value. The driver converts this
|
||||||
* to a SQL VARCHAR or LONGVARCHAR value (depending on the arguments
|
* to a SQL VARCHAR or LONGVARCHAR value (depending on the arguments
|
||||||
* size relative to the driver's limits on VARCHARs) when it sends it
|
* size relative to the driver's limits on VARCHARs) when it sends it
|
||||||
@ -279,7 +279,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java array of bytes. The driver converts this
|
* Set a parameter to a Java array of bytes. The driver converts this
|
||||||
* to a SQL VARBINARY or LONGVARBINARY (depending on the argument's
|
* to a SQL VARBINARY or LONGVARBINARY (depending on the argument's
|
||||||
* size relative to the driver's limits on VARBINARYs) when it sends
|
* size relative to the driver's limits on VARBINARYs) when it sends
|
||||||
@ -319,7 +319,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a java.sql.Date value. The driver converts this
|
* Set a parameter to a java.sql.Date value. The driver converts this
|
||||||
* to a SQL DATE value when it sends it to the database.
|
* to a SQL DATE value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -350,7 +350,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
//set(parameterIndex, df.format(new java.util.Date(x.getTime()+86400000)));
|
//set(parameterIndex, df.format(new java.util.Date(x.getTime()+86400000)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a java.sql.Time value. The driver converts
|
* Set a parameter to a java.sql.Time value. The driver converts
|
||||||
* this to a SQL TIME value when it sends it to the database.
|
* this to a SQL TIME value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -370,7 +370,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a java.sql.Timestamp value. The driver converts
|
* Set a parameter to a java.sql.Timestamp value. The driver converts
|
||||||
* this to a SQL TIMESTAMP value when it sends it to the database.
|
* this to a SQL TIMESTAMP value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -394,7 +394,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* When a very large ASCII value is input to a LONGVARCHAR parameter,
|
* When a very large ASCII value is input to a LONGVARCHAR parameter,
|
||||||
* it may be more practical to send it via a java.io.InputStream.
|
* it may be more practical to send it via a java.io.InputStream.
|
||||||
* JDBC will read the data from the stream as needed, until it reaches
|
* JDBC will read the data from the stream as needed, until it reaches
|
||||||
@ -444,7 +444,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* When a very large Unicode value is input to a LONGVARCHAR parameter,
|
* When a very large Unicode value is input to a LONGVARCHAR parameter,
|
||||||
* it may be more practical to send it via a java.io.InputStream.
|
* it may be more practical to send it via a java.io.InputStream.
|
||||||
* JDBC will read the data from the stream as needed, until it reaches
|
* JDBC will read the data from the stream as needed, until it reaches
|
||||||
@ -493,7 +493,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* When a very large binary value is input to a LONGVARBINARY parameter,
|
* When a very large binary value is input to a LONGVARBINARY parameter,
|
||||||
* it may be more practical to send it via a java.io.InputStream.
|
* it may be more practical to send it via a java.io.InputStream.
|
||||||
* JDBC will read the data from the stream as needed, until it reaches
|
* JDBC will read the data from the stream as needed, until it reaches
|
||||||
@ -572,7 +572,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* In general, parameter values remain in force for repeated used of a
|
* In general, parameter values remain in force for repeated used of a
|
||||||
* Statement. Setting a parameter value automatically clears its
|
* Statement. Setting a parameter value automatically clears its
|
||||||
* previous value. However, in coms cases, it is useful to immediately
|
* previous value. However, in coms cases, it is useful to immediately
|
||||||
@ -589,7 +589,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
inStrings[i] = null;
|
inStrings[i] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set the value of a parameter using an object; use the java.lang
|
* Set the value of a parameter using an object; use the java.lang
|
||||||
* equivalent objects for integral values.
|
* equivalent objects for integral values.
|
||||||
*
|
*
|
||||||
@ -672,7 +672,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
setObject(parameterIndex, x, targetSqlType, 0);
|
setObject(parameterIndex, x, targetSqlType, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This stores an Object into a parameter.
|
* This stores an Object into a parameter.
|
||||||
* <p>New for 6.4, if the object is not recognised, but it is
|
* <p>New for 6.4, if the object is not recognised, but it is
|
||||||
* Serializable, then the object is serialised using the
|
* Serializable, then the object is serialised using the
|
||||||
@ -715,7 +715,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
setLong(parameterIndex, connection.putObject(x));
|
setLong(parameterIndex, connection.putObject(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Some prepared statements return multiple results; the execute method
|
* Some prepared statements return multiple results; the execute method
|
||||||
* handles these complex statements as well as the simpler form of
|
* handles these complex statements as well as the simpler form of
|
||||||
* statements handled by executeQuery and executeUpdate
|
* statements handled by executeQuery and executeUpdate
|
||||||
@ -740,7 +740,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
return super.execute(s.toString()); // in Statement class
|
return super.execute(s.toString()); // in Statement class
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the SQL statement with the current template values
|
* Returns the SQL statement with the current template values
|
||||||
* substituted.
|
* substituted.
|
||||||
*/
|
*/
|
||||||
@ -765,7 +765,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
// END OF PUBLIC INTERFACE
|
// END OF PUBLIC INTERFACE
|
||||||
// **************************************************************
|
// **************************************************************
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* There are a lot of setXXX classes which all basically do
|
* There are a lot of setXXX classes which all basically do
|
||||||
* the same thing. We need a method which actually does the
|
* the same thing. We need a method which actually does the
|
||||||
* set for us.
|
* set for us.
|
||||||
|
@ -16,7 +16,7 @@ import org.postgresql.largeobject.*;
|
|||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
import org.postgresql.core.Encoding;
|
import org.postgresql.core.Encoding;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A ResultSet provides access to a table of data generated by executing a
|
* A ResultSet provides access to a table of data generated by executing a
|
||||||
* Statement. The table rows are retrieved in sequence. Within a row its
|
* Statement. The table rows are retrieved in sequence. Within a row its
|
||||||
* column values can be accessed in any order.
|
* column values can be accessed in any order.
|
||||||
@ -59,7 +59,7 @@ import org.postgresql.core.Encoding;
|
|||||||
*/
|
*/
|
||||||
public class ResultSet extends org.postgresql.ResultSet implements java.sql.ResultSet
|
public class ResultSet extends org.postgresql.ResultSet implements java.sql.ResultSet
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* Create a new ResultSet - Note that we create ResultSets to
|
* Create a new ResultSet - Note that we create ResultSets to
|
||||||
* represent the results of everything.
|
* represent the results of everything.
|
||||||
*
|
*
|
||||||
@ -75,7 +75,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
super(conn, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
super(conn, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Create a new ResultSet - Note that we create ResultSets to
|
* Create a new ResultSet - Note that we create ResultSets to
|
||||||
* represent the results of everything.
|
* represent the results of everything.
|
||||||
*
|
*
|
||||||
@ -91,7 +91,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
super(conn, fields, tuples, status, updateCount, 0, false);
|
super(conn, fields, tuples, status, updateCount, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A ResultSet is initially positioned before its first row,
|
* A ResultSet is initially positioned before its first row,
|
||||||
* the first call to next makes the first row the current row;
|
* the first call to next makes the first row the current row;
|
||||||
* the second call makes the second row the current row, etc.
|
* the second call makes the second row the current row, etc.
|
||||||
@ -112,7 +112,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* In some cases, it is desirable to immediately release a ResultSet
|
* In some cases, it is desirable to immediately release a ResultSet
|
||||||
* database and JDBC resources instead of waiting for this to happen
|
* database and JDBC resources instead of waiting for this to happen
|
||||||
* when it is automatically closed. The close method provides this
|
* when it is automatically closed. The close method provides this
|
||||||
@ -132,7 +132,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
rows.setSize(0);
|
rows.setSize(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A column may have the value of SQL NULL; wasNull() reports whether
|
* A column may have the value of SQL NULL; wasNull() reports whether
|
||||||
* the last column read had this special value. Note that you must
|
* the last column read had this special value. Note that you must
|
||||||
* first call getXXX on a column to try to read its value and then
|
* first call getXXX on a column to try to read its value and then
|
||||||
@ -146,7 +146,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return wasNullFlag;
|
return wasNullFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java String
|
* Get the value of a column in the current row as a Java String
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2...
|
* @param columnIndex the first column is 1, the second is 2...
|
||||||
@ -166,7 +166,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return encoding.decode(this_row[columnIndex - 1]);
|
return encoding.decode(this_row[columnIndex - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java boolean
|
* Get the value of a column in the current row as a Java boolean
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2...
|
* @param columnIndex the first column is 1, the second is 2...
|
||||||
@ -185,7 +185,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return false; // SQL NULL
|
return false; // SQL NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java byte.
|
* Get the value of a column in the current row as a Java byte.
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2,...
|
* @param columnIndex the first column is 1, the second is 2,...
|
||||||
@ -210,7 +210,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return 0; // SQL NULL
|
return 0; // SQL NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java short.
|
* Get the value of a column in the current row as a Java short.
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2,...
|
* @param columnIndex the first column is 1, the second is 2,...
|
||||||
@ -235,7 +235,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return 0; // SQL NULL
|
return 0; // SQL NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java int.
|
* Get the value of a column in the current row as a Java int.
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2,...
|
* @param columnIndex the first column is 1, the second is 2,...
|
||||||
@ -260,7 +260,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return 0; // SQL NULL
|
return 0; // SQL NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java long.
|
* Get the value of a column in the current row as a Java long.
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2,...
|
* @param columnIndex the first column is 1, the second is 2,...
|
||||||
@ -285,7 +285,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return 0; // SQL NULL
|
return 0; // SQL NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java float.
|
* Get the value of a column in the current row as a Java float.
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2,...
|
* @param columnIndex the first column is 1, the second is 2,...
|
||||||
@ -310,7 +310,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return 0; // SQL NULL
|
return 0; // SQL NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java double.
|
* Get the value of a column in the current row as a Java double.
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2,...
|
* @param columnIndex the first column is 1, the second is 2,...
|
||||||
@ -335,7 +335,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return 0; // SQL NULL
|
return 0; // SQL NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a
|
* Get the value of a column in the current row as a
|
||||||
* java.math.BigDecimal object
|
* java.math.BigDecimal object
|
||||||
*
|
*
|
||||||
@ -371,7 +371,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return null; // SQL NULL
|
return null; // SQL NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java byte array.
|
* Get the value of a column in the current row as a Java byte array.
|
||||||
*
|
*
|
||||||
* <p>In normal use, the bytes represent the raw values returned by the
|
* <p>In normal use, the bytes represent the raw values returned by the
|
||||||
@ -432,7 +432,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a java.sql.Date
|
* Get the value of a column in the current row as a java.sql.Date
|
||||||
* object
|
* object
|
||||||
*
|
*
|
||||||
@ -454,7 +454,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a java.sql.Time
|
* Get the value of a column in the current row as a java.sql.Time
|
||||||
* object
|
* object
|
||||||
*
|
*
|
||||||
@ -485,7 +485,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return null; // SQL NULL
|
return null; // SQL NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a
|
* Get the value of a column in the current row as a
|
||||||
* java.sql.Timestamp object
|
* java.sql.Timestamp object
|
||||||
*
|
*
|
||||||
@ -599,7 +599,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A column value can be retrieved as a stream of ASCII characters
|
* A column value can be retrieved as a stream of ASCII characters
|
||||||
* and then read in chunks from the stream. This method is
|
* and then read in chunks from the stream. This method is
|
||||||
* particular suitable for retrieving large LONGVARCHAR values.
|
* particular suitable for retrieving large LONGVARCHAR values.
|
||||||
@ -653,7 +653,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A column value can also be retrieved as a stream of Unicode
|
* A column value can also be retrieved as a stream of Unicode
|
||||||
* characters. We implement this as a binary stream.
|
* characters. We implement this as a binary stream.
|
||||||
*
|
*
|
||||||
@ -695,7 +695,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A column value can also be retrieved as a binary strea. This
|
* A column value can also be retrieved as a binary strea. This
|
||||||
* method is suitable for retrieving LONGVARBINARY values.
|
* method is suitable for retrieving LONGVARBINARY values.
|
||||||
*
|
*
|
||||||
@ -738,7 +738,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The following routines simply convert the columnName into
|
* The following routines simply convert the columnName into
|
||||||
* a columnIndex and then call the appropriate routine above.
|
* a columnIndex and then call the appropriate routine above.
|
||||||
*
|
*
|
||||||
@ -827,7 +827,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return getBinaryStream(findColumn(columnName));
|
return getBinaryStream(findColumn(columnName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The first warning reported by calls on this ResultSet is
|
* The first warning reported by calls on this ResultSet is
|
||||||
* returned. Subsequent ResultSet warnings will be chained
|
* returned. Subsequent ResultSet warnings will be chained
|
||||||
* to this SQLWarning.
|
* to this SQLWarning.
|
||||||
@ -848,7 +848,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return warnings;
|
return warnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* After this call, getWarnings returns null until a new warning
|
* After this call, getWarnings returns null until a new warning
|
||||||
* is reported for this ResultSet
|
* is reported for this ResultSet
|
||||||
*
|
*
|
||||||
@ -859,7 +859,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
warnings = null;
|
warnings = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the name of the SQL cursor used by this ResultSet
|
* Get the name of the SQL cursor used by this ResultSet
|
||||||
*
|
*
|
||||||
* <p>In SQL, a result table is retrieved though a cursor that is
|
* <p>In SQL, a result table is retrieved though a cursor that is
|
||||||
@ -882,7 +882,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return connection.getCursorName();
|
return connection.getCursorName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The numbers, types and properties of a ResultSet's columns are
|
* The numbers, types and properties of a ResultSet's columns are
|
||||||
* provided by the getMetaData method
|
* provided by the getMetaData method
|
||||||
*
|
*
|
||||||
@ -894,7 +894,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return new ResultSetMetaData(rows, fields);
|
return new ResultSetMetaData(rows, fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java object
|
* Get the value of a column in the current row as a Java object
|
||||||
*
|
*
|
||||||
* <p>This method will return the value of the given column as a
|
* <p>This method will return the value of the given column as a
|
||||||
@ -966,7 +966,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java object
|
* Get the value of a column in the current row as a Java object
|
||||||
*
|
*
|
||||||
*<p> This method will return the value of the given column as a
|
*<p> This method will return the value of the given column as a
|
||||||
@ -986,7 +986,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return getObject(findColumn(columnName));
|
return getObject(findColumn(columnName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Map a ResultSet column name to a ResultSet column index
|
* Map a ResultSet column name to a ResultSet column index
|
||||||
*
|
*
|
||||||
* @param columnName the name of the column
|
* @param columnName the name of the column
|
||||||
|
@ -16,7 +16,7 @@ import org.postgresql.util.*;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A ResultSetMetaData object can be used to find out about the types and
|
* A ResultSetMetaData object can be used to find out about the types and
|
||||||
* properties of the columns in a ResultSet
|
* properties of the columns in a ResultSet
|
||||||
*
|
*
|
||||||
@ -27,7 +27,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
Vector rows;
|
Vector rows;
|
||||||
Field[] fields;
|
Field[] fields;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Initialise for a result with a tuple set and
|
* Initialise for a result with a tuple set and
|
||||||
* a field descriptor set
|
* a field descriptor set
|
||||||
*
|
*
|
||||||
@ -40,7 +40,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Whats the number of columns in the ResultSet?
|
* Whats the number of columns in the ResultSet?
|
||||||
*
|
*
|
||||||
* @return the number
|
* @return the number
|
||||||
@ -51,7 +51,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return fields.length;
|
return fields.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Is the column automatically numbered (and thus read-only)
|
* Is the column automatically numbered (and thus read-only)
|
||||||
* I believe that PostgreSQL does not support this feature.
|
* I believe that PostgreSQL does not support this feature.
|
||||||
*
|
*
|
||||||
@ -64,7 +64,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Does a column's case matter? ASSUMPTION: Any field that is
|
* Does a column's case matter? ASSUMPTION: Any field that is
|
||||||
* not obviously case insensitive is assumed to be case sensitive
|
* not obviously case insensitive is assumed to be case sensitive
|
||||||
*
|
*
|
||||||
@ -92,7 +92,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Can the column be used in a WHERE clause? Basically for
|
* Can the column be used in a WHERE clause? Basically for
|
||||||
* this, I split the functions into two types: recognised
|
* this, I split the functions into two types: recognised
|
||||||
* types (which are always useable), and OTHER types (which
|
* types (which are always useable), and OTHER types (which
|
||||||
@ -119,7 +119,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Is the column a cash value? 6.1 introduced the cash/money
|
* Is the column a cash value? 6.1 introduced the cash/money
|
||||||
* type, which haven't been incorporated as of 970414, so I
|
* type, which haven't been incorporated as of 970414, so I
|
||||||
* just check the type name for both 'cash' and 'money'
|
* just check the type name for both 'cash' and 'money'
|
||||||
@ -135,7 +135,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return type_name.equals("cash") || type_name.equals("money");
|
return type_name.equals("cash") || type_name.equals("money");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Indicates the nullability of values in the designated column.
|
* Indicates the nullability of values in the designated column.
|
||||||
*
|
*
|
||||||
* @param column the first column is 1, the second is 2...
|
* @param column the first column is 1, the second is 2...
|
||||||
@ -152,7 +152,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return columnNullableUnknown;
|
return columnNullableUnknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Is the column a signed number? In PostgreSQL, all numbers
|
* Is the column a signed number? In PostgreSQL, all numbers
|
||||||
* are signed, so this is trivial. However, strings are not
|
* are signed, so this is trivial. However, strings are not
|
||||||
* signed (duh!)
|
* signed (duh!)
|
||||||
@ -182,7 +182,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What is the column's normal maximum width in characters?
|
* What is the column's normal maximum width in characters?
|
||||||
*
|
*
|
||||||
* @param column the first column is 1, the second is 2, etc.
|
* @param column the first column is 1, the second is 2, etc.
|
||||||
@ -238,7 +238,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return f.getLength();
|
return f.getLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What is the suggested column title for use in printouts and
|
* What is the suggested column title for use in printouts and
|
||||||
* displays? We suggest the ColumnName!
|
* displays? We suggest the ColumnName!
|
||||||
*
|
*
|
||||||
@ -251,7 +251,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return getColumnName(column);
|
return getColumnName(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What's a column's name?
|
* What's a column's name?
|
||||||
*
|
*
|
||||||
* @param column the first column is 1, the second is 2, etc.
|
* @param column the first column is 1, the second is 2, etc.
|
||||||
@ -266,7 +266,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return "field" + column;
|
return "field" + column;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What is a column's table's schema? This relies on us knowing
|
* What is a column's table's schema? This relies on us knowing
|
||||||
* the table name....which I don't know how to do as yet. The
|
* the table name....which I don't know how to do as yet. The
|
||||||
* JDBC specification allows us to return "" if this is not
|
* JDBC specification allows us to return "" if this is not
|
||||||
@ -281,7 +281,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What is a column's number of decimal digits.
|
* What is a column's number of decimal digits.
|
||||||
*
|
*
|
||||||
* @param column the first column is 1, the second is 2...
|
* @param column the first column is 1, the second is 2...
|
||||||
@ -317,7 +317,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What is a column's number of digits to the right of the
|
* What is a column's number of digits to the right of the
|
||||||
* decimal point?
|
* decimal point?
|
||||||
*
|
*
|
||||||
@ -354,7 +354,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Whats a column's table's name? How do I find this out? Both
|
* Whats a column's table's name? How do I find this out? Both
|
||||||
* getSchemaName() and getCatalogName() rely on knowing the table
|
* getSchemaName() and getCatalogName() rely on knowing the table
|
||||||
* Name, so we need this before we can work on them.
|
* Name, so we need this before we can work on them.
|
||||||
@ -368,7 +368,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What's a column's table's catalog name? As with getSchemaName(),
|
* What's a column's table's catalog name? As with getSchemaName(),
|
||||||
* we can say that if getTableName() returns n/a, then we can too -
|
* we can say that if getTableName() returns n/a, then we can too -
|
||||||
* otherwise, we need to work on it.
|
* otherwise, we need to work on it.
|
||||||
@ -382,7 +382,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What is a column's SQL Type? (java.sql.Type int)
|
* What is a column's SQL Type? (java.sql.Type int)
|
||||||
*
|
*
|
||||||
* @param column the first column is 1, the second is 2, etc.
|
* @param column the first column is 1, the second is 2, etc.
|
||||||
@ -396,7 +396,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return getField(column).getSQLType();
|
return getField(column).getSQLType();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Whats is the column's data source specific type name?
|
* Whats is the column's data source specific type name?
|
||||||
*
|
*
|
||||||
* @param column the first column is 1, the second is 2, etc.
|
* @param column the first column is 1, the second is 2, etc.
|
||||||
@ -408,7 +408,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return getField(column).getPGType();
|
return getField(column).getPGType();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Is the column definitely not writable? In reality, we would
|
* Is the column definitely not writable? In reality, we would
|
||||||
* have to check the GRANT/REVOKE stuff for this to be effective,
|
* have to check the GRANT/REVOKE stuff for this to be effective,
|
||||||
* and I haven't really looked into that yet, so this will get
|
* and I haven't really looked into that yet, so this will get
|
||||||
@ -423,7 +423,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Is it possible for a write on the column to succeed? Again, we
|
* Is it possible for a write on the column to succeed? Again, we
|
||||||
* would in reality have to check the GRANT/REVOKE stuff, which
|
* would in reality have to check the GRANT/REVOKE stuff, which
|
||||||
* I haven't worked with as yet. However, if it isn't ReadOnly, then
|
* I haven't worked with as yet. However, if it isn't ReadOnly, then
|
||||||
@ -438,7 +438,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return !isReadOnly(column);
|
return !isReadOnly(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Will a write on this column definately succeed? Hmmm...this
|
* Will a write on this column definately succeed? Hmmm...this
|
||||||
* is a bad one, since the two preceding functions have not been
|
* is a bad one, since the two preceding functions have not been
|
||||||
* really defined. I cannot tell is the short answer. I thus
|
* really defined. I cannot tell is the short answer. I thus
|
||||||
@ -457,7 +457,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
// END OF PUBLIC INTERFACE
|
// END OF PUBLIC INTERFACE
|
||||||
// ********************************************************
|
// ********************************************************
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* For several routines in this package, we need to convert
|
* For several routines in this package, we need to convert
|
||||||
* a columnIndex into a Field[] descriptor. Rather than do
|
* a columnIndex into a Field[] descriptor. Rather than do
|
||||||
* the same code several times, here it is.
|
* the same code several times, here it is.
|
||||||
|
@ -9,7 +9,7 @@ import java.sql.*;
|
|||||||
|
|
||||||
import org.postgresql.util.PSQLException;
|
import org.postgresql.util.PSQLException;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A Statement object is used for executing a static SQL statement and
|
* A Statement object is used for executing a static SQL statement and
|
||||||
* obtaining the results produced by it.
|
* obtaining the results produced by it.
|
||||||
*
|
*
|
||||||
@ -26,7 +26,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
{
|
{
|
||||||
private Connection connection; // The connection who created us
|
private Connection connection; // The connection who created us
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructor for a Statement. It simply sets the connection
|
* Constructor for a Statement. It simply sets the connection
|
||||||
* that created us.
|
* that created us.
|
||||||
*
|
*
|
||||||
@ -37,7 +37,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
connection = c;
|
connection = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Execute a SQL statement that retruns a single ResultSet
|
* Execute a SQL statement that retruns a single ResultSet
|
||||||
*
|
*
|
||||||
* @param sql typically a static SQL SELECT statement
|
* @param sql typically a static SQL SELECT statement
|
||||||
@ -54,7 +54,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Execute a SQL INSERT, UPDATE or DELETE statement. In addition
|
* Execute a SQL INSERT, UPDATE or DELETE statement. In addition
|
||||||
* SQL statements that return nothing such as SQL DDL statements
|
* SQL statements that return nothing such as SQL DDL statements
|
||||||
* can be executed
|
* can be executed
|
||||||
@ -71,7 +71,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
return this.getUpdateCount();
|
return this.getUpdateCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* setCursorName defines the SQL cursor name that will be used by
|
* setCursorName defines the SQL cursor name that will be used by
|
||||||
* subsequent execute methods. This name can then be used in SQL
|
* subsequent execute methods. This name can then be used in SQL
|
||||||
* positioned update/delete statements to identify the current row
|
* positioned update/delete statements to identify the current row
|
||||||
@ -95,7 +95,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
connection.setCursorName(name);
|
connection.setCursorName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Execute a SQL statement that may return multiple results. We
|
* Execute a SQL statement that may return multiple results. We
|
||||||
* don't have to worry about this since we do not support multiple
|
* don't have to worry about this since we do not support multiple
|
||||||
* ResultSets. You can use getResultSet or getUpdateCount to
|
* ResultSets. You can use getResultSet or getUpdateCount to
|
||||||
@ -114,7 +114,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
return (result != null && ((org.postgresql.ResultSet)result).reallyResultSet());
|
return (result != null && ((org.postgresql.ResultSet)result).reallyResultSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* getUpdateCount returns the current result as an update count,
|
* getUpdateCount returns the current result as an update count,
|
||||||
* if the result is a ResultSet or there are no more results, -1
|
* if the result is a ResultSet or there are no more results, -1
|
||||||
* is returned. It should only be called once per result.
|
* is returned. It should only be called once per result.
|
||||||
@ -131,7 +131,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
return ((org.postgresql.ResultSet)result).getResultCount();
|
return ((org.postgresql.ResultSet)result).getResultCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* getMoreResults moves to a Statement's next result. If it returns
|
* getMoreResults moves to a Statement's next result. If it returns
|
||||||
* true, this result is a ResulSet.
|
* true, this result is a ResulSet.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +7,7 @@ import java.math.BigDecimal;
|
|||||||
import org.postgresql.Field;
|
import org.postgresql.Field;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Array is used collect one column of query result data.
|
* Array is used collect one column of query result data.
|
||||||
*
|
*
|
||||||
* <p>Read a field of type Array into either a natively-typed
|
* <p>Read a field of type Array into either a natively-typed
|
||||||
@ -31,7 +31,7 @@ public class Array implements java.sql.Array
|
|||||||
private int idx = 0;
|
private int idx = 0;
|
||||||
private String rawString = null;
|
private String rawString = null;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Create a new Array
|
* Create a new Array
|
||||||
*
|
*
|
||||||
* @param conn a database connection
|
* @param conn a database connection
|
||||||
|
@ -8,7 +8,7 @@ package org.postgresql.jdbc2;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.math.*;
|
import java.math.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* CallableStatement is used to execute SQL stored procedures.
|
* CallableStatement is used to execute SQL stored procedures.
|
||||||
*
|
*
|
||||||
* <p>JDBC provides a stored procedure SQL escape that allows stored
|
* <p>JDBC provides a stored procedure SQL escape that allows stored
|
||||||
@ -41,7 +41,7 @@ import java.math.*;
|
|||||||
|
|
||||||
public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement implements java.sql.CallableStatement
|
public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement implements java.sql.CallableStatement
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* @exception SQLException on failure
|
* @exception SQLException on failure
|
||||||
*/
|
*/
|
||||||
public CallableStatement(Connection c, String q) throws SQLException
|
public CallableStatement(Connection c, String q) throws SQLException
|
||||||
@ -49,7 +49,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
super(c, q);
|
super(c, q);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Before executing a stored procedure call you must explicitly
|
* Before executing a stored procedure call you must explicitly
|
||||||
* call registerOutParameter to register the java.sql.Type of each
|
* call registerOutParameter to register the java.sql.Type of each
|
||||||
* out parameter.
|
* out parameter.
|
||||||
@ -67,7 +67,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
|
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* You must also specify the scale for numeric/decimal types:
|
* You must also specify the scale for numeric/decimal types:
|
||||||
*
|
*
|
||||||
* <p>Note: When reading the value of an out parameter, you must use
|
* <p>Note: When reading the value of an out parameter, you must use
|
||||||
@ -89,7 +89,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
//return true;
|
//return true;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* An OUT parameter may have the value of SQL NULL; wasNull
|
* An OUT parameter may have the value of SQL NULL; wasNull
|
||||||
* reports whether the last value read has this special value.
|
* reports whether the last value read has this special value.
|
||||||
*
|
*
|
||||||
@ -109,7 +109,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
//return null;
|
//return null;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a CHAR, VARCHAR, or LONGVARCHAR parameter as a
|
* Get the value of a CHAR, VARCHAR, or LONGVARCHAR parameter as a
|
||||||
* Java String.
|
* Java String.
|
||||||
*
|
*
|
||||||
@ -129,7 +129,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
//return null;
|
//return null;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a BIT parameter as a Java boolean.
|
* Get the value of a BIT parameter as a Java boolean.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -141,7 +141,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a TINYINT parameter as a Java byte.
|
* Get the value of a TINYINT parameter as a Java byte.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -153,7 +153,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a SMALLINT parameter as a Java short.
|
* Get the value of a SMALLINT parameter as a Java short.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -165,7 +165,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of an INTEGER parameter as a Java int.
|
* Get the value of an INTEGER parameter as a Java int.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -177,7 +177,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a BIGINT parameter as a Java long.
|
* Get the value of a BIGINT parameter as a Java long.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -189,7 +189,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a FLOAT parameter as a Java float.
|
* Get the value of a FLOAT parameter as a Java float.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -201,7 +201,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
return (float) 0.0;
|
return (float) 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a DOUBLE parameter as a Java double.
|
* Get the value of a DOUBLE parameter as a Java double.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -213,7 +213,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a NUMERIC parameter as a java.math.BigDecimal
|
* Get the value of a NUMERIC parameter as a java.math.BigDecimal
|
||||||
* object.
|
* object.
|
||||||
*
|
*
|
||||||
@ -230,7 +230,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a SQL BINARY or VARBINARY parameter as a Java
|
* Get the value of a SQL BINARY or VARBINARY parameter as a Java
|
||||||
* byte[]
|
* byte[]
|
||||||
*
|
*
|
||||||
@ -248,7 +248,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
//return null;
|
//return null;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a SQL DATE parameter as a java.sql.Date object
|
* Get the value of a SQL DATE parameter as a java.sql.Date object
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -260,7 +260,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a SQL TIME parameter as a java.sql.Time object.
|
* Get the value of a SQL TIME parameter as a java.sql.Time object.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -272,7 +272,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a SQL TIMESTAMP parameter as a java.sql.Timestamp object.
|
* Get the value of a SQL TIMESTAMP parameter as a java.sql.Timestamp object.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2,...
|
* @param parameterIndex the first parameter is 1, the second is 2,...
|
||||||
@ -296,7 +296,7 @@ public class CallableStatement extends org.postgresql.jdbc2.PreparedStatement im
|
|||||||
|
|
||||||
// getObject returns a Java object for the parameter.
|
// getObject returns a Java object for the parameter.
|
||||||
// See the JDBC spec's "Dynamic Programming" chapter for details.
|
// See the JDBC spec's "Dynamic Programming" chapter for details.
|
||||||
/**
|
/*
|
||||||
* Get the value of a parameter as a Java object.
|
* Get the value of a parameter as a Java object.
|
||||||
*
|
*
|
||||||
* <p>This method returns a Java object whose type coresponds to the
|
* <p>This method returns a Java object whose type coresponds to the
|
||||||
|
@ -16,8 +16,8 @@ import org.postgresql.fastpath.*;
|
|||||||
import org.postgresql.largeobject.*;
|
import org.postgresql.largeobject.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* $Id: Connection.java,v 1.14 2001/10/25 05:59:59 momjian Exp $
|
* $Id: Connection.java,v 1.15 2001/11/19 22:33:38 momjian Exp $
|
||||||
*
|
*
|
||||||
* A Connection represents a session with a specific database. Within the
|
* A Connection represents a session with a specific database. Within the
|
||||||
* context of a Connection, SQL statements are executed and results are
|
* context of a Connection, SQL statements are executed and results are
|
||||||
@ -39,12 +39,12 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
// This is a cache of the DatabaseMetaData instance for this connection
|
// This is a cache of the DatabaseMetaData instance for this connection
|
||||||
protected DatabaseMetaData metadata;
|
protected DatabaseMetaData metadata;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The current type mappings
|
* The current type mappings
|
||||||
*/
|
*/
|
||||||
protected java.util.Map typemap;
|
protected java.util.Map typemap;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* SQL statements without parameters are normally executed using
|
* SQL statements without parameters are normally executed using
|
||||||
* Statement objects. If the same SQL statement is executed many
|
* Statement objects. If the same SQL statement is executed many
|
||||||
* times, it is more efficient to use a PreparedStatement
|
* times, it is more efficient to use a PreparedStatement
|
||||||
@ -59,7 +59,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
return createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.CONCUR_READ_ONLY);
|
return createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.CONCUR_READ_ONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* SQL statements without parameters are normally executed using
|
* SQL statements without parameters are normally executed using
|
||||||
* Statement objects. If the same SQL statement is executed many
|
* Statement objects. If the same SQL statement is executed many
|
||||||
* times, it is more efficient to use a PreparedStatement
|
* times, it is more efficient to use a PreparedStatement
|
||||||
@ -78,7 +78,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A SQL statement with or without IN parameters can be pre-compiled
|
* A SQL statement with or without IN parameters can be pre-compiled
|
||||||
* and stored in a PreparedStatement object. This object can then
|
* and stored in a PreparedStatement object. This object can then
|
||||||
* be used to efficiently execute this statement multiple times.
|
* be used to efficiently execute this statement multiple times.
|
||||||
@ -109,7 +109,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A SQL stored procedure call statement is handled by creating a
|
* A SQL stored procedure call statement is handled by creating a
|
||||||
* CallableStatement for it. The CallableStatement provides methods
|
* CallableStatement for it. The CallableStatement provides methods
|
||||||
* for setting up its IN and OUT parameters and methods for executing
|
* for setting up its IN and OUT parameters and methods for executing
|
||||||
@ -142,7 +142,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
//return s;
|
//return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests to see if a Connection is closed.
|
* Tests to see if a Connection is closed.
|
||||||
*
|
*
|
||||||
* Peter Feb 7 2000: Now I've discovered that this doesn't actually obey the
|
* Peter Feb 7 2000: Now I've discovered that this doesn't actually obey the
|
||||||
@ -187,7 +187,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A connection's database is able to provide information describing
|
* A connection's database is able to provide information describing
|
||||||
* its tables, its supported SQL grammar, its stored procedures, the
|
* its tables, its supported SQL grammar, its stored procedures, the
|
||||||
* capabilities of this connection, etc. This information is made
|
* capabilities of this connection, etc. This information is made
|
||||||
@ -203,7 +203,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This overides the method in org.postgresql.Connection and returns a
|
* This overides the method in org.postgresql.Connection and returns a
|
||||||
* ResultSet.
|
* ResultSet.
|
||||||
*/
|
*/
|
||||||
@ -237,7 +237,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
typemap = map;
|
typemap = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This overides the standard internal getObject method so that we can
|
* This overides the standard internal getObject method so that we can
|
||||||
* check the jdbc2 type map first
|
* check the jdbc2 type map first
|
||||||
*
|
*
|
||||||
@ -280,7 +280,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
return sqlType;
|
return sqlType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This table holds the org.postgresql names for the types supported.
|
* This table holds the org.postgresql names for the types supported.
|
||||||
* Any types that map to Types.OTHER (eg POINT) don't go into this table.
|
* Any types that map to Types.OTHER (eg POINT) don't go into this table.
|
||||||
* They default automatically to Types.OTHER
|
* They default automatically to Types.OTHER
|
||||||
@ -310,7 +310,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
|||||||
"_bytea"
|
"_bytea"
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This table holds the JDBC type for each entry above.
|
* This table holds the JDBC type for each entry above.
|
||||||
*
|
*
|
||||||
* Note: This must be in the same order as above
|
* Note: This must be in the same order as above
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@ package org.postgresql.jdbc2;
|
|||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This class extends java.sql.BatchUpdateException, and provides our
|
* This class extends java.sql.BatchUpdateException, and provides our
|
||||||
* internationalisation handling.
|
* internationalisation handling.
|
||||||
*/
|
*/
|
||||||
|
@ -13,7 +13,7 @@ import java.util.*;
|
|||||||
import org.postgresql.largeobject.*;
|
import org.postgresql.largeobject.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A SQL Statement is pre-compiled and stored in a PreparedStatement object.
|
* A SQL Statement is pre-compiled and stored in a PreparedStatement object.
|
||||||
* This object can then be used to efficiently execute this statement multiple
|
* This object can then be used to efficiently execute this statement multiple
|
||||||
* times.
|
* times.
|
||||||
@ -44,7 +44,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
private static ThreadLocal tl_df = new ThreadLocal(); // setDate() SimpleDateFormat
|
private static ThreadLocal tl_df = new ThreadLocal(); // setDate() SimpleDateFormat
|
||||||
private static ThreadLocal tl_tsdf = new ThreadLocal(); // setTimestamp() SimpleDateFormat
|
private static ThreadLocal tl_tsdf = new ThreadLocal(); // setTimestamp() SimpleDateFormat
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructor for the PreparedStatement class.
|
* Constructor for the PreparedStatement class.
|
||||||
* Split the SQL statement into segments - separated by the arguments.
|
* Split the SQL statement into segments - separated by the arguments.
|
||||||
* When we rebuild the thing with the arguments, we can substitute the
|
* When we rebuild the thing with the arguments, we can substitute the
|
||||||
@ -87,7 +87,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
templateStrings[i] = (String)v.elementAt(i);
|
templateStrings[i] = (String)v.elementAt(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A Prepared SQL query is executed and its ResultSet is returned
|
* A Prepared SQL query is executed and its ResultSet is returned
|
||||||
*
|
*
|
||||||
* @return a ResultSet that contains the data produced by the
|
* @return a ResultSet that contains the data produced by the
|
||||||
@ -99,7 +99,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
return super.executeQuery(compileQuery()); // in Statement class
|
return super.executeQuery(compileQuery()); // in Statement class
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Execute a SQL INSERT, UPDATE or DELETE statement. In addition,
|
* Execute a SQL INSERT, UPDATE or DELETE statement. In addition,
|
||||||
* SQL statements that return nothing such as SQL DDL statements can
|
* SQL statements that return nothing such as SQL DDL statements can
|
||||||
* be executed.
|
* be executed.
|
||||||
@ -113,7 +113,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
return super.executeUpdate(compileQuery()); // in Statement class
|
return super.executeUpdate(compileQuery()); // in Statement class
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper - this compiles the SQL query from the various parameters
|
* Helper - this compiles the SQL query from the various parameters
|
||||||
* This is identical to toString() except it throws an exception if a
|
* This is identical to toString() except it throws an exception if a
|
||||||
* parameter is unused.
|
* parameter is unused.
|
||||||
@ -134,7 +134,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
return sbuf.toString();
|
return sbuf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to SQL NULL
|
* Set a parameter to SQL NULL
|
||||||
*
|
*
|
||||||
* <p><B>Note:</B> You must specify the parameters SQL type (although
|
* <p><B>Note:</B> You must specify the parameters SQL type (although
|
||||||
@ -149,7 +149,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, "null");
|
set(parameterIndex, "null");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java boolean value. The driver converts this
|
* Set a parameter to a Java boolean value. The driver converts this
|
||||||
* to a SQL BIT value when it sends it to the database.
|
* to a SQL BIT value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -162,7 +162,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, x ? "'t'" : "'f'");
|
set(parameterIndex, x ? "'t'" : "'f'");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java byte value. The driver converts this to
|
* Set a parameter to a Java byte value. The driver converts this to
|
||||||
* a SQL TINYINT value when it sends it to the database.
|
* a SQL TINYINT value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -175,7 +175,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, Integer.toString(x));
|
set(parameterIndex, Integer.toString(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java short value. The driver converts this
|
* Set a parameter to a Java short value. The driver converts this
|
||||||
* to a SQL SMALLINT value when it sends it to the database.
|
* to a SQL SMALLINT value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -188,7 +188,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, Integer.toString(x));
|
set(parameterIndex, Integer.toString(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java int value. The driver converts this to
|
* Set a parameter to a Java int value. The driver converts this to
|
||||||
* a SQL INTEGER value when it sends it to the database.
|
* a SQL INTEGER value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -201,7 +201,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, Integer.toString(x));
|
set(parameterIndex, Integer.toString(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java long value. The driver converts this to
|
* Set a parameter to a Java long value. The driver converts this to
|
||||||
* a SQL BIGINT value when it sends it to the database.
|
* a SQL BIGINT value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -214,7 +214,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, Long.toString(x));
|
set(parameterIndex, Long.toString(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java float value. The driver converts this
|
* Set a parameter to a Java float value. The driver converts this
|
||||||
* to a SQL FLOAT value when it sends it to the database.
|
* to a SQL FLOAT value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -227,7 +227,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, Float.toString(x));
|
set(parameterIndex, Float.toString(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java double value. The driver converts this
|
* Set a parameter to a Java double value. The driver converts this
|
||||||
* to a SQL DOUBLE value when it sends it to the database
|
* to a SQL DOUBLE value when it sends it to the database
|
||||||
*
|
*
|
||||||
@ -240,7 +240,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, Double.toString(x));
|
set(parameterIndex, Double.toString(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a java.lang.BigDecimal value. The driver
|
* Set a parameter to a java.lang.BigDecimal value. The driver
|
||||||
* converts this to a SQL NUMERIC value when it sends it to the
|
* converts this to a SQL NUMERIC value when it sends it to the
|
||||||
* database.
|
* database.
|
||||||
@ -254,7 +254,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
set(parameterIndex, x.toString());
|
set(parameterIndex, x.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java String value. The driver converts this
|
* Set a parameter to a Java String value. The driver converts this
|
||||||
* to a SQL VARCHAR or LONGVARCHAR value (depending on the arguments
|
* to a SQL VARCHAR or LONGVARCHAR value (depending on the arguments
|
||||||
* size relative to the driver's limits on VARCHARs) when it sends it
|
* size relative to the driver's limits on VARCHARs) when it sends it
|
||||||
@ -292,7 +292,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a Java array of bytes. The driver converts this
|
* Set a parameter to a Java array of bytes. The driver converts this
|
||||||
* to a SQL VARBINARY or LONGVARBINARY (depending on the argument's
|
* to a SQL VARBINARY or LONGVARBINARY (depending on the argument's
|
||||||
* size relative to the driver's limits on VARBINARYs) when it sends
|
* size relative to the driver's limits on VARBINARYs) when it sends
|
||||||
@ -332,7 +332,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a java.sql.Date value. The driver converts this
|
* Set a parameter to a java.sql.Date value. The driver converts this
|
||||||
* to a SQL DATE value when it sends it to the database.
|
* to a SQL DATE value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -368,7 +368,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
//set(parameterIndex, df.format(new java.util.Date(x.getTime()+86400000)));
|
//set(parameterIndex, df.format(new java.util.Date(x.getTime()+86400000)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a java.sql.Time value. The driver converts
|
* Set a parameter to a java.sql.Time value. The driver converts
|
||||||
* this to a SQL TIME value when it sends it to the database.
|
* this to a SQL TIME value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -388,7 +388,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a java.sql.Timestamp value. The driver converts
|
* Set a parameter to a java.sql.Timestamp value. The driver converts
|
||||||
* this to a SQL TIMESTAMP value when it sends it to the database.
|
* this to a SQL TIMESTAMP value when it sends it to the database.
|
||||||
*
|
*
|
||||||
@ -426,7 +426,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* When a very large ASCII value is input to a LONGVARCHAR parameter,
|
* When a very large ASCII value is input to a LONGVARCHAR parameter,
|
||||||
* it may be more practical to send it via a java.io.InputStream.
|
* it may be more practical to send it via a java.io.InputStream.
|
||||||
* JDBC will read the data from the stream as needed, until it reaches
|
* JDBC will read the data from the stream as needed, until it reaches
|
||||||
@ -476,7 +476,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* When a very large Unicode value is input to a LONGVARCHAR parameter,
|
* When a very large Unicode value is input to a LONGVARCHAR parameter,
|
||||||
* it may be more practical to send it via a java.io.InputStream.
|
* it may be more practical to send it via a java.io.InputStream.
|
||||||
* JDBC will read the data from the stream as needed, until it reaches
|
* JDBC will read the data from the stream as needed, until it reaches
|
||||||
@ -528,7 +528,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* When a very large binary value is input to a LONGVARBINARY parameter,
|
* When a very large binary value is input to a LONGVARBINARY parameter,
|
||||||
* it may be more practical to send it via a java.io.InputStream.
|
* it may be more practical to send it via a java.io.InputStream.
|
||||||
* JDBC will read the data from the stream as needed, until it reaches
|
* JDBC will read the data from the stream as needed, until it reaches
|
||||||
@ -607,7 +607,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* In general, parameter values remain in force for repeated used of a
|
* In general, parameter values remain in force for repeated used of a
|
||||||
* Statement. Setting a parameter value automatically clears its
|
* Statement. Setting a parameter value automatically clears its
|
||||||
* previous value. However, in coms cases, it is useful to immediately
|
* previous value. However, in coms cases, it is useful to immediately
|
||||||
@ -624,7 +624,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
inStrings[i] = null;
|
inStrings[i] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set the value of a parameter using an object; use the java.lang
|
* Set the value of a parameter using an object; use the java.lang
|
||||||
* equivalent objects for integral values.
|
* equivalent objects for integral values.
|
||||||
*
|
*
|
||||||
@ -707,7 +707,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
setObject(parameterIndex, x, targetSqlType, 0);
|
setObject(parameterIndex, x, targetSqlType, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This stores an Object into a parameter.
|
* This stores an Object into a parameter.
|
||||||
* <p>New for 6.4, if the object is not recognised, but it is
|
* <p>New for 6.4, if the object is not recognised, but it is
|
||||||
* Serializable, then the object is serialised using the
|
* Serializable, then the object is serialised using the
|
||||||
@ -751,7 +751,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
setSerialize(parameterIndex, connection.putObject(x), x.getClass().getName() );
|
setSerialize(parameterIndex, connection.putObject(x), x.getClass().getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Some prepared statements return multiple results; the execute method
|
* Some prepared statements return multiple results; the execute method
|
||||||
* handles these complex statements as well as the simpler form of
|
* handles these complex statements as well as the simpler form of
|
||||||
* statements handled by executeQuery and executeUpdate
|
* statements handled by executeQuery and executeUpdate
|
||||||
@ -765,7 +765,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
return super.execute(compileQuery()); // in Statement class
|
return super.execute(compileQuery()); // in Statement class
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the SQL statement with the current template values
|
* Returns the SQL statement with the current template values
|
||||||
* substituted.
|
* substituted.
|
||||||
* NB: This is identical to compileQuery() except instead of throwing
|
* NB: This is identical to compileQuery() except instead of throwing
|
||||||
@ -795,7 +795,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
// END OF PUBLIC INTERFACE
|
// END OF PUBLIC INTERFACE
|
||||||
// **************************************************************
|
// **************************************************************
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* There are a lot of setXXX classes which all basically do
|
* There are a lot of setXXX classes which all basically do
|
||||||
* the same thing. We need a method which actually does the
|
* the same thing. We need a method which actually does the
|
||||||
* set for us.
|
* set for us.
|
||||||
@ -811,7 +811,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
inStrings[paramIndex - 1] = s;
|
inStrings[paramIndex - 1] = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Set a parameter to a tablerow-type oid reference.
|
* Set a parameter to a tablerow-type oid reference.
|
||||||
*
|
*
|
||||||
* @param parameterIndex the first parameter is 1...
|
* @param parameterIndex the first parameter is 1...
|
||||||
@ -836,7 +836,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
|
|
||||||
// ** JDBC 2 Extensions **
|
// ** JDBC 2 Extensions **
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This parses the query and adds it to the current batch
|
* This parses the query and adds it to the current batch
|
||||||
*/
|
*/
|
||||||
public void addBatch() throws SQLException
|
public void addBatch() throws SQLException
|
||||||
@ -844,7 +844,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
super.addBatch(compileQuery());
|
super.addBatch(compileQuery());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Not sure what this one does, so I'm saying this returns the MetaData for
|
* Not sure what this one does, so I'm saying this returns the MetaData for
|
||||||
* the last ResultSet returned!
|
* the last ResultSet returned!
|
||||||
*/
|
*/
|
||||||
@ -863,7 +863,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
setString(i, x.toString());
|
setString(i, x.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Sets a Blob
|
* Sets a Blob
|
||||||
*/
|
*/
|
||||||
public void setBlob(int i, Blob x) throws SQLException
|
public void setBlob(int i, Blob x) throws SQLException
|
||||||
@ -897,7 +897,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
setInt(i, oid);
|
setInt(i, oid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This is similar to setBinaryStream except it uses a Reader instead of
|
* This is similar to setBinaryStream except it uses a Reader instead of
|
||||||
* InputStream.
|
* InputStream.
|
||||||
*/
|
*/
|
||||||
@ -956,7 +956,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* New in 7.1
|
* New in 7.1
|
||||||
*/
|
*/
|
||||||
public void setClob(int i, Clob x) throws SQLException
|
public void setClob(int i, Clob x) throws SQLException
|
||||||
@ -990,7 +990,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
setInt(i, oid);
|
setInt(i, oid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* At least this works as in PostgreSQL null represents anything null ;-)
|
* At least this works as in PostgreSQL null represents anything null ;-)
|
||||||
*
|
*
|
||||||
* New in 7,1
|
* New in 7,1
|
||||||
@ -1005,7 +1005,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
throw org.postgresql.Driver.notImplemented();
|
throw org.postgresql.Driver.notImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* New in 7,1
|
* New in 7,1
|
||||||
*/
|
*/
|
||||||
public void setDate(int i, java.sql.Date d, java.util.Calendar cal) throws SQLException
|
public void setDate(int i, java.sql.Date d, java.util.Calendar cal) throws SQLException
|
||||||
@ -1019,7 +1019,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* New in 7,1
|
* New in 7,1
|
||||||
*/
|
*/
|
||||||
public void setTime(int i, Time t, java.util.Calendar cal) throws SQLException
|
public void setTime(int i, Time t, java.util.Calendar cal) throws SQLException
|
||||||
@ -1033,7 +1033,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* New in 7,1
|
* New in 7,1
|
||||||
*/
|
*/
|
||||||
public void setTimestamp(int i, Timestamp t, java.util.Calendar cal) throws SQLException
|
public void setTimestamp(int i, Timestamp t, java.util.Calendar cal) throws SQLException
|
||||||
|
@ -16,7 +16,7 @@ import org.postgresql.largeobject.*;
|
|||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
import org.postgresql.core.Encoding;
|
import org.postgresql.core.Encoding;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A ResultSet provides access to a table of data generated by executing a
|
* A ResultSet provides access to a table of data generated by executing a
|
||||||
* Statement. The table rows are retrieved in sequence. Within a row its
|
* Statement. The table rows are retrieved in sequence. Within a row its
|
||||||
* column values can be accessed in any order.
|
* column values can be accessed in any order.
|
||||||
@ -63,7 +63,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
|
|
||||||
private StringBuffer sbuf = null;
|
private StringBuffer sbuf = null;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Create a new ResultSet - Note that we create ResultSets to
|
* Create a new ResultSet - Note that we create ResultSets to
|
||||||
* represent the results of everything.
|
* represent the results of everything.
|
||||||
*
|
*
|
||||||
@ -79,7 +79,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
super(conn, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
super(conn, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Create a new ResultSet - Note that we create ResultSets to
|
* Create a new ResultSet - Note that we create ResultSets to
|
||||||
* represent the results of everything.
|
* represent the results of everything.
|
||||||
*
|
*
|
||||||
@ -95,7 +95,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
super(conn, fields, tuples, status, updateCount, 0, false);
|
super(conn, fields, tuples, status, updateCount, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A ResultSet is initially positioned before its first row,
|
* A ResultSet is initially positioned before its first row,
|
||||||
* the first call to next makes the first row the current row;
|
* the first call to next makes the first row the current row;
|
||||||
* the second call makes the second row the current row, etc.
|
* the second call makes the second row the current row, etc.
|
||||||
@ -116,7 +116,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* In some cases, it is desirable to immediately release a ResultSet
|
* In some cases, it is desirable to immediately release a ResultSet
|
||||||
* database and JDBC resources instead of waiting for this to happen
|
* database and JDBC resources instead of waiting for this to happen
|
||||||
* when it is automatically closed. The close method provides this
|
* when it is automatically closed. The close method provides this
|
||||||
@ -139,7 +139,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A column may have the value of SQL NULL; wasNull() reports whether
|
* A column may have the value of SQL NULL; wasNull() reports whether
|
||||||
* the last column read had this special value. Note that you must
|
* the last column read had this special value. Note that you must
|
||||||
* first call getXXX on a column to try to read its value and then
|
* first call getXXX on a column to try to read its value and then
|
||||||
@ -153,7 +153,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return wasNullFlag;
|
return wasNullFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java String
|
* Get the value of a column in the current row as a Java String
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2...
|
* @param columnIndex the first column is 1, the second is 2...
|
||||||
@ -173,7 +173,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return encoding.decode(this_row[columnIndex - 1]);
|
return encoding.decode(this_row[columnIndex - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java boolean
|
* Get the value of a column in the current row as a Java boolean
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2...
|
* @param columnIndex the first column is 1, the second is 2...
|
||||||
@ -185,7 +185,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return toBoolean( getString(columnIndex) );
|
return toBoolean( getString(columnIndex) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java byte.
|
* Get the value of a column in the current row as a Java byte.
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2,...
|
* @param columnIndex the first column is 1, the second is 2,...
|
||||||
@ -210,7 +210,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return 0; // SQL NULL
|
return 0; // SQL NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java short.
|
* Get the value of a column in the current row as a Java short.
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2,...
|
* @param columnIndex the first column is 1, the second is 2,...
|
||||||
@ -235,7 +235,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return 0; // SQL NULL
|
return 0; // SQL NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java int.
|
* Get the value of a column in the current row as a Java int.
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2,...
|
* @param columnIndex the first column is 1, the second is 2,...
|
||||||
@ -247,7 +247,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return toInt( getFixedString(columnIndex) );
|
return toInt( getFixedString(columnIndex) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java long.
|
* Get the value of a column in the current row as a Java long.
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2,...
|
* @param columnIndex the first column is 1, the second is 2,...
|
||||||
@ -259,7 +259,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return toLong( getFixedString(columnIndex) );
|
return toLong( getFixedString(columnIndex) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java float.
|
* Get the value of a column in the current row as a Java float.
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2,...
|
* @param columnIndex the first column is 1, the second is 2,...
|
||||||
@ -271,7 +271,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return toFloat( getFixedString(columnIndex) );
|
return toFloat( getFixedString(columnIndex) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java double.
|
* Get the value of a column in the current row as a Java double.
|
||||||
*
|
*
|
||||||
* @param columnIndex the first column is 1, the second is 2,...
|
* @param columnIndex the first column is 1, the second is 2,...
|
||||||
@ -283,7 +283,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return toDouble( getFixedString(columnIndex) );
|
return toDouble( getFixedString(columnIndex) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a
|
* Get the value of a column in the current row as a
|
||||||
* java.math.BigDecimal object
|
* java.math.BigDecimal object
|
||||||
*
|
*
|
||||||
@ -298,7 +298,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return toBigDecimal( getFixedString(columnIndex), scale );
|
return toBigDecimal( getFixedString(columnIndex), scale );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java byte array.
|
* Get the value of a column in the current row as a Java byte array.
|
||||||
*
|
*
|
||||||
* <p>In normal use, the bytes represent the raw values returned by the
|
* <p>In normal use, the bytes represent the raw values returned by the
|
||||||
@ -359,7 +359,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a java.sql.Date
|
* Get the value of a column in the current row as a java.sql.Date
|
||||||
* object
|
* object
|
||||||
*
|
*
|
||||||
@ -372,7 +372,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return toDate( getString(columnIndex) );
|
return toDate( getString(columnIndex) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a java.sql.Time
|
* Get the value of a column in the current row as a java.sql.Time
|
||||||
* object
|
* object
|
||||||
*
|
*
|
||||||
@ -385,7 +385,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return toTime( getString(columnIndex) );
|
return toTime( getString(columnIndex) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a
|
* Get the value of a column in the current row as a
|
||||||
* java.sql.Timestamp object
|
* java.sql.Timestamp object
|
||||||
*
|
*
|
||||||
@ -398,7 +398,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return toTimestamp( getString(columnIndex), this );
|
return toTimestamp( getString(columnIndex), this );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A column value can be retrieved as a stream of ASCII characters
|
* A column value can be retrieved as a stream of ASCII characters
|
||||||
* and then read in chunks from the stream. This method is
|
* and then read in chunks from the stream. This method is
|
||||||
* particular suitable for retrieving large LONGVARCHAR values.
|
* particular suitable for retrieving large LONGVARCHAR values.
|
||||||
@ -452,7 +452,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A column value can also be retrieved as a stream of Unicode
|
* A column value can also be retrieved as a stream of Unicode
|
||||||
* characters. We implement this as a binary stream.
|
* characters. We implement this as a binary stream.
|
||||||
*
|
*
|
||||||
@ -497,7 +497,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A column value can also be retrieved as a binary strea. This
|
* A column value can also be retrieved as a binary strea. This
|
||||||
* method is suitable for retrieving LONGVARBINARY values.
|
* method is suitable for retrieving LONGVARBINARY values.
|
||||||
*
|
*
|
||||||
@ -540,7 +540,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The following routines simply convert the columnName into
|
* The following routines simply convert the columnName into
|
||||||
* a columnIndex and then call the appropriate routine above.
|
* a columnIndex and then call the appropriate routine above.
|
||||||
*
|
*
|
||||||
@ -589,7 +589,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return getDouble(findColumn(columnName));
|
return getDouble(findColumn(columnName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException
|
public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException
|
||||||
@ -622,7 +622,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return getAsciiStream(findColumn(columnName));
|
return getAsciiStream(findColumn(columnName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* ** DEPRECATED IN JDBC 2 **
|
* ** DEPRECATED IN JDBC 2 **
|
||||||
*
|
*
|
||||||
@ -638,7 +638,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return getBinaryStream(findColumn(columnName));
|
return getBinaryStream(findColumn(columnName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The first warning reported by calls on this ResultSet is
|
* The first warning reported by calls on this ResultSet is
|
||||||
* returned. Subsequent ResultSet warnings will be chained
|
* returned. Subsequent ResultSet warnings will be chained
|
||||||
* to this SQLWarning.
|
* to this SQLWarning.
|
||||||
@ -659,7 +659,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return warnings;
|
return warnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* After this call, getWarnings returns null until a new warning
|
* After this call, getWarnings returns null until a new warning
|
||||||
* is reported for this ResultSet
|
* is reported for this ResultSet
|
||||||
*
|
*
|
||||||
@ -670,7 +670,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
warnings = null;
|
warnings = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the name of the SQL cursor used by this ResultSet
|
* Get the name of the SQL cursor used by this ResultSet
|
||||||
*
|
*
|
||||||
* <p>In SQL, a result table is retrieved though a cursor that is
|
* <p>In SQL, a result table is retrieved though a cursor that is
|
||||||
@ -693,7 +693,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return connection.getCursorName();
|
return connection.getCursorName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The numbers, types and properties of a ResultSet's columns are
|
* The numbers, types and properties of a ResultSet's columns are
|
||||||
* provided by the getMetaData method
|
* provided by the getMetaData method
|
||||||
*
|
*
|
||||||
@ -705,7 +705,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return new ResultSetMetaData(rows, fields);
|
return new ResultSetMetaData(rows, fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java object
|
* Get the value of a column in the current row as a Java object
|
||||||
*
|
*
|
||||||
* <p>This method will return the value of the given column as a
|
* <p>This method will return the value of the given column as a
|
||||||
@ -783,7 +783,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Get the value of a column in the current row as a Java object
|
* Get the value of a column in the current row as a Java object
|
||||||
*
|
*
|
||||||
*<p> This method will return the value of the given column as a
|
*<p> This method will return the value of the given column as a
|
||||||
@ -803,7 +803,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return getObject(findColumn(columnName));
|
return getObject(findColumn(columnName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Map a ResultSet column name to a ResultSet column index
|
* Map a ResultSet column name to a ResultSet column index
|
||||||
*
|
*
|
||||||
* @param columnName the name of the column
|
* @param columnName the name of the column
|
||||||
@ -964,7 +964,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* New in 7.1
|
* New in 7.1
|
||||||
*/
|
*/
|
||||||
public Clob getClob(String columnName) throws SQLException
|
public Clob getClob(String columnName) throws SQLException
|
||||||
@ -972,7 +972,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return getClob(findColumn(columnName));
|
return getClob(findColumn(columnName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* New in 7.1
|
* New in 7.1
|
||||||
*/
|
*/
|
||||||
public Clob getClob(int i) throws SQLException
|
public Clob getClob(int i) throws SQLException
|
||||||
@ -1046,7 +1046,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return getObject(findColumn(columnName), map);
|
return getObject(findColumn(columnName), map);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This checks against map for the type of column i, and if found returns
|
* This checks against map for the type of column i, and if found returns
|
||||||
* an object based on that mapping. The class must implement the SQLData
|
* an object based on that mapping. The class must implement the SQLData
|
||||||
* interface.
|
* interface.
|
||||||
@ -1446,7 +1446,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
throw new PSQLException("postgresql.noupdate");
|
throw new PSQLException("postgresql.noupdate");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This is called by Statement to register itself with this statement.
|
* This is called by Statement to register itself with this statement.
|
||||||
* It's used currently by getStatement() but may also with the new core
|
* It's used currently by getStatement() but may also with the new core
|
||||||
* package.
|
* package.
|
||||||
|
@ -11,7 +11,7 @@ import java.util.*;
|
|||||||
import org.postgresql.*;
|
import org.postgresql.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A ResultSetMetaData object can be used to find out about the types and
|
* A ResultSetMetaData object can be used to find out about the types and
|
||||||
* properties of the columns in a ResultSet
|
* properties of the columns in a ResultSet
|
||||||
*
|
*
|
||||||
@ -22,7 +22,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
Vector rows;
|
Vector rows;
|
||||||
Field[] fields;
|
Field[] fields;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Initialise for a result with a tuple set and
|
* Initialise for a result with a tuple set and
|
||||||
* a field descriptor set
|
* a field descriptor set
|
||||||
*
|
*
|
||||||
@ -35,7 +35,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Whats the number of columns in the ResultSet?
|
* Whats the number of columns in the ResultSet?
|
||||||
*
|
*
|
||||||
* @return the number
|
* @return the number
|
||||||
@ -46,7 +46,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return fields.length;
|
return fields.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Is the column automatically numbered (and thus read-only)
|
* Is the column automatically numbered (and thus read-only)
|
||||||
* I believe that PostgreSQL does not support this feature.
|
* I believe that PostgreSQL does not support this feature.
|
||||||
*
|
*
|
||||||
@ -59,7 +59,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Does a column's case matter? ASSUMPTION: Any field that is
|
* Does a column's case matter? ASSUMPTION: Any field that is
|
||||||
* not obviously case insensitive is assumed to be case sensitive
|
* not obviously case insensitive is assumed to be case sensitive
|
||||||
*
|
*
|
||||||
@ -87,7 +87,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Can the column be used in a WHERE clause? Basically for
|
* Can the column be used in a WHERE clause? Basically for
|
||||||
* this, I split the functions into two types: recognised
|
* this, I split the functions into two types: recognised
|
||||||
* types (which are always useable), and OTHER types (which
|
* types (which are always useable), and OTHER types (which
|
||||||
@ -114,7 +114,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Is the column a cash value? 6.1 introduced the cash/money
|
* Is the column a cash value? 6.1 introduced the cash/money
|
||||||
* type, which haven't been incorporated as of 970414, so I
|
* type, which haven't been incorporated as of 970414, so I
|
||||||
* just check the type name for both 'cash' and 'money'
|
* just check the type name for both 'cash' and 'money'
|
||||||
@ -130,7 +130,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return type_name.equals("cash") || type_name.equals("money");
|
return type_name.equals("cash") || type_name.equals("money");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Indicates the nullability of values in the designated column.
|
* Indicates the nullability of values in the designated column.
|
||||||
*
|
*
|
||||||
* @param column the first column is 1, the second is 2...
|
* @param column the first column is 1, the second is 2...
|
||||||
@ -147,7 +147,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return columnNullableUnknown;
|
return columnNullableUnknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Is the column a signed number? In PostgreSQL, all numbers
|
* Is the column a signed number? In PostgreSQL, all numbers
|
||||||
* are signed, so this is trivial. However, strings are not
|
* are signed, so this is trivial. However, strings are not
|
||||||
* signed (duh!)
|
* signed (duh!)
|
||||||
@ -177,7 +177,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What is the column's normal maximum width in characters?
|
* What is the column's normal maximum width in characters?
|
||||||
*
|
*
|
||||||
* @param column the first column is 1, the second is 2, etc.
|
* @param column the first column is 1, the second is 2, etc.
|
||||||
@ -233,7 +233,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return f.getLength();
|
return f.getLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What is the suggested column title for use in printouts and
|
* What is the suggested column title for use in printouts and
|
||||||
* displays? We suggest the ColumnName!
|
* displays? We suggest the ColumnName!
|
||||||
*
|
*
|
||||||
@ -246,7 +246,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return getColumnName(column);
|
return getColumnName(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What's a column's name?
|
* What's a column's name?
|
||||||
*
|
*
|
||||||
* @param column the first column is 1, the second is 2, etc.
|
* @param column the first column is 1, the second is 2, etc.
|
||||||
@ -261,7 +261,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return "field" + column;
|
return "field" + column;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What is a column's table's schema? This relies on us knowing
|
* What is a column's table's schema? This relies on us knowing
|
||||||
* the table name....which I don't know how to do as yet. The
|
* the table name....which I don't know how to do as yet. The
|
||||||
* JDBC specification allows us to return "" if this is not
|
* JDBC specification allows us to return "" if this is not
|
||||||
@ -276,7 +276,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What is a column's number of decimal digits.
|
* What is a column's number of decimal digits.
|
||||||
*
|
*
|
||||||
* @param column the first column is 1, the second is 2...
|
* @param column the first column is 1, the second is 2...
|
||||||
@ -312,7 +312,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What is a column's number of digits to the right of the
|
* What is a column's number of digits to the right of the
|
||||||
* decimal point?
|
* decimal point?
|
||||||
*
|
*
|
||||||
@ -349,7 +349,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Whats a column's table's name? How do I find this out? Both
|
* Whats a column's table's name? How do I find this out? Both
|
||||||
* getSchemaName() and getCatalogName() rely on knowing the table
|
* getSchemaName() and getCatalogName() rely on knowing the table
|
||||||
* Name, so we need this before we can work on them.
|
* Name, so we need this before we can work on them.
|
||||||
@ -363,7 +363,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What's a column's table's catalog name? As with getSchemaName(),
|
* What's a column's table's catalog name? As with getSchemaName(),
|
||||||
* we can say that if getTableName() returns n/a, then we can too -
|
* we can say that if getTableName() returns n/a, then we can too -
|
||||||
* otherwise, we need to work on it.
|
* otherwise, we need to work on it.
|
||||||
@ -377,7 +377,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* What is a column's SQL Type? (java.sql.Type int)
|
* What is a column's SQL Type? (java.sql.Type int)
|
||||||
*
|
*
|
||||||
* @param column the first column is 1, the second is 2, etc.
|
* @param column the first column is 1, the second is 2, etc.
|
||||||
@ -391,7 +391,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return getField(column).getSQLType();
|
return getField(column).getSQLType();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Whats is the column's data source specific type name?
|
* Whats is the column's data source specific type name?
|
||||||
*
|
*
|
||||||
* @param column the first column is 1, the second is 2, etc.
|
* @param column the first column is 1, the second is 2, etc.
|
||||||
@ -403,7 +403,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return getField(column).getPGType();
|
return getField(column).getPGType();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Is the column definitely not writable? In reality, we would
|
* Is the column definitely not writable? In reality, we would
|
||||||
* have to check the GRANT/REVOKE stuff for this to be effective,
|
* have to check the GRANT/REVOKE stuff for this to be effective,
|
||||||
* and I haven't really looked into that yet, so this will get
|
* and I haven't really looked into that yet, so this will get
|
||||||
@ -418,7 +418,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Is it possible for a write on the column to succeed? Again, we
|
* Is it possible for a write on the column to succeed? Again, we
|
||||||
* would in reality have to check the GRANT/REVOKE stuff, which
|
* would in reality have to check the GRANT/REVOKE stuff, which
|
||||||
* I haven't worked with as yet. However, if it isn't ReadOnly, then
|
* I haven't worked with as yet. However, if it isn't ReadOnly, then
|
||||||
@ -433,7 +433,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
return !isReadOnly(column);
|
return !isReadOnly(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Will a write on this column definately succeed? Hmmm...this
|
* Will a write on this column definately succeed? Hmmm...this
|
||||||
* is a bad one, since the two preceding functions have not been
|
* is a bad one, since the two preceding functions have not been
|
||||||
* really defined. I cannot tell is the short answer. I thus
|
* really defined. I cannot tell is the short answer. I thus
|
||||||
@ -452,7 +452,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
|
|||||||
// END OF PUBLIC INTERFACE
|
// END OF PUBLIC INTERFACE
|
||||||
// ********************************************************
|
// ********************************************************
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* For several routines in this package, we need to convert
|
* For several routines in this package, we need to convert
|
||||||
* a columnIndex into a Field[] descriptor. Rather than do
|
* a columnIndex into a Field[] descriptor. Rather than do
|
||||||
* the same code several times, here it is.
|
* the same code several times, here it is.
|
||||||
|
@ -9,7 +9,7 @@ import java.sql.*;
|
|||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A Statement object is used for executing a static SQL statement and
|
* A Statement object is used for executing a static SQL statement and
|
||||||
* obtaining the results produced by it.
|
* obtaining the results produced by it.
|
||||||
*
|
*
|
||||||
@ -29,7 +29,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
private int resultsettype; // the resultset type to return
|
private int resultsettype; // the resultset type to return
|
||||||
private int concurrency; // is it updateable or not?
|
private int concurrency; // is it updateable or not?
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructor for a Statement. It simply sets the connection
|
* Constructor for a Statement. It simply sets the connection
|
||||||
* that created us.
|
* that created us.
|
||||||
*
|
*
|
||||||
@ -42,7 +42,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
concurrency = java.sql.ResultSet.CONCUR_READ_ONLY;
|
concurrency = java.sql.ResultSet.CONCUR_READ_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Execute a SQL statement that retruns a single ResultSet
|
* Execute a SQL statement that retruns a single ResultSet
|
||||||
*
|
*
|
||||||
* @param sql typically a static SQL SELECT statement
|
* @param sql typically a static SQL SELECT statement
|
||||||
@ -59,7 +59,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Execute a SQL INSERT, UPDATE or DELETE statement. In addition
|
* Execute a SQL INSERT, UPDATE or DELETE statement. In addition
|
||||||
* SQL statements that return nothing such as SQL DDL statements
|
* SQL statements that return nothing such as SQL DDL statements
|
||||||
* can be executed
|
* can be executed
|
||||||
@ -76,7 +76,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
return this.getUpdateCount();
|
return this.getUpdateCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* setCursorName defines the SQL cursor name that will be used by
|
* setCursorName defines the SQL cursor name that will be used by
|
||||||
* subsequent execute methods. This name can then be used in SQL
|
* subsequent execute methods. This name can then be used in SQL
|
||||||
* positioned update/delete statements to identify the current row
|
* positioned update/delete statements to identify the current row
|
||||||
@ -100,7 +100,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
connection.setCursorName(name);
|
connection.setCursorName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Execute a SQL statement that may return multiple results. We
|
* Execute a SQL statement that may return multiple results. We
|
||||||
* don't have to worry about this since we do not support multiple
|
* don't have to worry about this since we do not support multiple
|
||||||
* ResultSets. You can use getResultSet or getUpdateCount to
|
* ResultSets. You can use getResultSet or getUpdateCount to
|
||||||
@ -135,7 +135,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
return (result != null && ((org.postgresql.ResultSet)result).reallyResultSet());
|
return (result != null && ((org.postgresql.ResultSet)result).reallyResultSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* getUpdateCount returns the current result as an update count,
|
* getUpdateCount returns the current result as an update count,
|
||||||
* if the result is a ResultSet or there are no more results, -1
|
* if the result is a ResultSet or there are no more results, -1
|
||||||
* is returned. It should only be called once per result.
|
* is returned. It should only be called once per result.
|
||||||
@ -152,7 +152,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
return ((org.postgresql.ResultSet)result).getResultCount();
|
return ((org.postgresql.ResultSet)result).getResultCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* getMoreResults moves to a Statement's next result. If it returns
|
* getMoreResults moves to a Statement's next result. If it returns
|
||||||
* true, this result is a ResulSet.
|
* true, this result is a ResulSet.
|
||||||
*
|
*
|
||||||
@ -249,7 +249,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
throw org.postgresql.Driver.notImplemented();
|
throw org.postgresql.Driver.notImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* New in 7.1
|
* New in 7.1
|
||||||
*/
|
*/
|
||||||
public void setResultSetConcurrency(int value) throws SQLException
|
public void setResultSetConcurrency(int value) throws SQLException
|
||||||
@ -257,7 +257,7 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
|
|||||||
concurrency = value;
|
concurrency = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* New in 7.1
|
* New in 7.1
|
||||||
*/
|
*/
|
||||||
public void setResultSetType(int value) throws SQLException
|
public void setResultSetType(int value) throws SQLException
|
||||||
|
@ -21,7 +21,7 @@ import org.postgresql.Field;
|
|||||||
import org.postgresql.largeobject.*;
|
import org.postgresql.largeobject.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @see ResultSet
|
* @see ResultSet
|
||||||
* @see ResultSetMetaData
|
* @see ResultSetMetaData
|
||||||
* @see java.sql.ResultSet
|
* @see java.sql.ResultSet
|
||||||
@ -29,7 +29,7 @@ import org.postgresql.util.*;
|
|||||||
public class UpdateableResultSet extends org.postgresql.jdbc2.ResultSet
|
public class UpdateableResultSet extends org.postgresql.jdbc2.ResultSet
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Create a new ResultSet - Note that we create ResultSets to
|
* Create a new ResultSet - Note that we create ResultSets to
|
||||||
* represent the results of everything.
|
* represent the results of everything.
|
||||||
*
|
*
|
||||||
@ -45,7 +45,7 @@ public class UpdateableResultSet extends org.postgresql.jdbc2.ResultSet
|
|||||||
super(conn, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
super(conn, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Create a new ResultSet - Note that we create ResultSets to
|
* Create a new ResultSet - Note that we create ResultSets to
|
||||||
* represent the results of everything.
|
* represent the results of everything.
|
||||||
*
|
*
|
||||||
|
@ -4,39 +4,39 @@ import java.io.InputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This is an initial implementation of an InputStream from a large object.
|
* This is an initial implementation of an InputStream from a large object.
|
||||||
* For now, the bare minimum is implemented. Later (after 7.1) we will overide
|
* For now, the bare minimum is implemented. Later (after 7.1) we will overide
|
||||||
* the other read methods to optimise them.
|
* the other read methods to optimise them.
|
||||||
*/
|
*/
|
||||||
public class BlobInputStream extends InputStream
|
public class BlobInputStream extends InputStream
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* The parent LargeObject
|
* The parent LargeObject
|
||||||
*/
|
*/
|
||||||
private LargeObject lo;
|
private LargeObject lo;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Buffer used to improve performance
|
* Buffer used to improve performance
|
||||||
*/
|
*/
|
||||||
private byte[] buffer;
|
private byte[] buffer;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Position within buffer
|
* Position within buffer
|
||||||
*/
|
*/
|
||||||
private int bpos;
|
private int bpos;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The buffer size
|
* The buffer size
|
||||||
*/
|
*/
|
||||||
private int bsize;
|
private int bsize;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The mark position
|
* The mark position
|
||||||
*/
|
*/
|
||||||
private int mpos = 0;
|
private int mpos = 0;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param lo LargeObject to read from
|
* @param lo LargeObject to read from
|
||||||
*/
|
*/
|
||||||
public BlobInputStream(LargeObject lo)
|
public BlobInputStream(LargeObject lo)
|
||||||
@ -44,7 +44,7 @@ public class BlobInputStream extends InputStream
|
|||||||
this(lo, 1024);
|
this(lo, 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param lo LargeObject to read from
|
* @param lo LargeObject to read from
|
||||||
* @param bsize buffer size
|
* @param bsize buffer size
|
||||||
*/
|
*/
|
||||||
@ -56,7 +56,7 @@ public class BlobInputStream extends InputStream
|
|||||||
this.bsize = bsize;
|
this.bsize = bsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The minimum required to implement input stream
|
* The minimum required to implement input stream
|
||||||
*/
|
*/
|
||||||
public int read() throws java.io.IOException
|
public int read() throws java.io.IOException
|
||||||
@ -92,7 +92,7 @@ public class BlobInputStream extends InputStream
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Closes this input stream and releases any system resources associated
|
* Closes this input stream and releases any system resources associated
|
||||||
* with the stream.
|
* with the stream.
|
||||||
*
|
*
|
||||||
@ -114,7 +114,7 @@ public class BlobInputStream extends InputStream
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Marks the current position in this input stream. A subsequent call to
|
* Marks the current position in this input stream. A subsequent call to
|
||||||
* the <code>reset</code> method repositions this stream at the last marked
|
* the <code>reset</code> method repositions this stream at the last marked
|
||||||
* position so that subsequent reads re-read the same bytes.
|
* position so that subsequent reads re-read the same bytes.
|
||||||
@ -150,7 +150,7 @@ public class BlobInputStream extends InputStream
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Repositions this stream to the position at the time the
|
* Repositions this stream to the position at the time the
|
||||||
* <code>mark</code> method was last called on this input stream.
|
* <code>mark</code> method was last called on this input stream.
|
||||||
* NB: If mark is not called we move to the begining.
|
* NB: If mark is not called we move to the begining.
|
||||||
@ -170,7 +170,7 @@ public class BlobInputStream extends InputStream
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests if this input stream supports the <code>mark</code> and
|
* Tests if this input stream supports the <code>mark</code> and
|
||||||
* <code>reset</code> methods. The <code>markSupported</code> method of
|
* <code>reset</code> methods. The <code>markSupported</code> method of
|
||||||
* <code>InputStream</code> returns <code>false</code>.
|
* <code>InputStream</code> returns <code>false</code>.
|
||||||
|
@ -4,32 +4,32 @@ import java.io.IOException;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This implements a basic output stream that writes to a LargeObject
|
* This implements a basic output stream that writes to a LargeObject
|
||||||
*/
|
*/
|
||||||
public class BlobOutputStream extends OutputStream
|
public class BlobOutputStream extends OutputStream
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* The parent LargeObject
|
* The parent LargeObject
|
||||||
*/
|
*/
|
||||||
private LargeObject lo;
|
private LargeObject lo;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Buffer
|
* Buffer
|
||||||
*/
|
*/
|
||||||
private byte buf[];
|
private byte buf[];
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Size of the buffer (default 1K)
|
* Size of the buffer (default 1K)
|
||||||
*/
|
*/
|
||||||
private int bsize;
|
private int bsize;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Position within the buffer
|
* Position within the buffer
|
||||||
*/
|
*/
|
||||||
private int bpos;
|
private int bpos;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Create an OutputStream to a large object
|
* Create an OutputStream to a large object
|
||||||
* @param lo LargeObject
|
* @param lo LargeObject
|
||||||
*/
|
*/
|
||||||
@ -38,7 +38,7 @@ public class BlobOutputStream extends OutputStream
|
|||||||
this(lo, 1024);
|
this(lo, 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Create an OutputStream to a large object
|
* Create an OutputStream to a large object
|
||||||
* @param lo LargeObject
|
* @param lo LargeObject
|
||||||
* @param bsize The size of the buffer used to improve performance
|
* @param bsize The size of the buffer used to improve performance
|
||||||
@ -68,7 +68,7 @@ public class BlobOutputStream extends OutputStream
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Flushes this output stream and forces any buffered output bytes
|
* Flushes this output stream and forces any buffered output bytes
|
||||||
* to be written out. The general contract of <code>flush</code> is
|
* to be written out. The general contract of <code>flush</code> is
|
||||||
* that calling it is an indication that, if any bytes previously
|
* that calling it is an indication that, if any bytes previously
|
||||||
@ -92,7 +92,7 @@ public class BlobOutputStream extends OutputStream
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Closes this output stream and releases any system resources
|
* Closes this output stream and releases any system resources
|
||||||
* associated with this stream. The general contract of <code>close</code>
|
* associated with this stream. The general contract of <code>close</code>
|
||||||
* is that it closes the output stream. A closed stream cannot perform
|
* is that it closes the output stream. A closed stream cannot perform
|
||||||
|
@ -8,7 +8,7 @@ import java.sql.*;
|
|||||||
|
|
||||||
import org.postgresql.fastpath.*;
|
import org.postgresql.fastpath.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This class implements the large object interface to org.postgresql.
|
* This class implements the large object interface to org.postgresql.
|
||||||
*
|
*
|
||||||
* <p>It provides the basic methods required to run the interface, plus
|
* <p>It provides the basic methods required to run the interface, plus
|
||||||
@ -43,17 +43,17 @@ import org.postgresql.fastpath.*;
|
|||||||
*/
|
*/
|
||||||
public class LargeObject
|
public class LargeObject
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* Indicates a seek from the begining of a file
|
* Indicates a seek from the begining of a file
|
||||||
*/
|
*/
|
||||||
public static final int SEEK_SET = 0;
|
public static final int SEEK_SET = 0;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Indicates a seek from the current position
|
* Indicates a seek from the current position
|
||||||
*/
|
*/
|
||||||
public static final int SEEK_CUR = 1;
|
public static final int SEEK_CUR = 1;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Indicates a seek from the end of a file
|
* Indicates a seek from the end of a file
|
||||||
*/
|
*/
|
||||||
public static final int SEEK_END = 2;
|
public static final int SEEK_END = 2;
|
||||||
@ -66,7 +66,7 @@ public class LargeObject
|
|||||||
|
|
||||||
private boolean closed = false; // true when we are closed
|
private boolean closed = false; // true when we are closed
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This opens a large object.
|
* This opens a large object.
|
||||||
*
|
*
|
||||||
* <p>If the object does not exist, then an SQLException is thrown.
|
* <p>If the object does not exist, then an SQLException is thrown.
|
||||||
@ -95,7 +95,7 @@ public class LargeObject
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the OID of this LargeObject
|
* @return the OID of this LargeObject
|
||||||
*/
|
*/
|
||||||
public int getOID()
|
public int getOID()
|
||||||
@ -103,7 +103,7 @@ public class LargeObject
|
|||||||
return oid;
|
return oid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This method closes the object. You must not call methods in this
|
* This method closes the object. You must not call methods in this
|
||||||
* object after this is called.
|
* object after this is called.
|
||||||
* @exception SQLException if a database-access error occurs.
|
* @exception SQLException if a database-access error occurs.
|
||||||
@ -138,7 +138,7 @@ public class LargeObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Reads some data from the object, and return as a byte[] array
|
* Reads some data from the object, and return as a byte[] array
|
||||||
*
|
*
|
||||||
* @param len number of bytes to read
|
* @param len number of bytes to read
|
||||||
@ -179,7 +179,7 @@ public class LargeObject
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Reads some data from the object into an existing array
|
* Reads some data from the object into an existing array
|
||||||
*
|
*
|
||||||
* @param buf destination array
|
* @param buf destination array
|
||||||
@ -197,7 +197,7 @@ public class LargeObject
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Writes an array to the object
|
* Writes an array to the object
|
||||||
*
|
*
|
||||||
* @param buf array to write
|
* @param buf array to write
|
||||||
@ -211,7 +211,7 @@ public class LargeObject
|
|||||||
fp.fastpath("lowrite", false, args);
|
fp.fastpath("lowrite", false, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Writes some data from an array to the object
|
* Writes some data from an array to the object
|
||||||
*
|
*
|
||||||
* @param buf destination array
|
* @param buf destination array
|
||||||
@ -226,7 +226,7 @@ public class LargeObject
|
|||||||
write(data);
|
write(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Sets the current position within the object.
|
* Sets the current position within the object.
|
||||||
*
|
*
|
||||||
* <p>This is similar to the fseek() call in the standard C library. It
|
* <p>This is similar to the fseek() call in the standard C library. It
|
||||||
@ -245,7 +245,7 @@ public class LargeObject
|
|||||||
fp.fastpath("lo_lseek", false, args);
|
fp.fastpath("lo_lseek", false, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Sets the current position within the object.
|
* Sets the current position within the object.
|
||||||
*
|
*
|
||||||
* <p>This is similar to the fseek() call in the standard C library. It
|
* <p>This is similar to the fseek() call in the standard C library. It
|
||||||
@ -259,7 +259,7 @@ public class LargeObject
|
|||||||
seek(pos, SEEK_SET);
|
seek(pos, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the current position within the object
|
* @return the current position within the object
|
||||||
* @exception SQLException if a database-access error occurs.
|
* @exception SQLException if a database-access error occurs.
|
||||||
*/
|
*/
|
||||||
@ -270,7 +270,7 @@ public class LargeObject
|
|||||||
return fp.getInteger("lo_tell", args);
|
return fp.getInteger("lo_tell", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This method is inefficient, as the only way to find out the size of
|
* This method is inefficient, as the only way to find out the size of
|
||||||
* the object is to seek to the end, record the current position, then
|
* the object is to seek to the end, record the current position, then
|
||||||
* return to the original position.
|
* return to the original position.
|
||||||
@ -289,7 +289,7 @@ public class LargeObject
|
|||||||
return sz;
|
return sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns an InputStream from this object.
|
* Returns an InputStream from this object.
|
||||||
*
|
*
|
||||||
* <p>This InputStream can then be used in any method that requires an
|
* <p>This InputStream can then be used in any method that requires an
|
||||||
@ -302,7 +302,7 @@ public class LargeObject
|
|||||||
return new BlobInputStream(this);
|
return new BlobInputStream(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns an OutputStream to this object
|
* Returns an OutputStream to this object
|
||||||
*
|
*
|
||||||
* <p>This OutputStream can then be used in any method that requires an
|
* <p>This OutputStream can then be used in any method that requires an
|
||||||
|
@ -9,7 +9,7 @@ import java.sql.*;
|
|||||||
import org.postgresql.fastpath.*;
|
import org.postgresql.fastpath.*;
|
||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This class implements the large object interface to org.postgresql.
|
* This class implements the large object interface to org.postgresql.
|
||||||
*
|
*
|
||||||
* <p>It provides methods that allow client code to create, open and delete
|
* <p>It provides methods that allow client code to create, open and delete
|
||||||
@ -61,29 +61,29 @@ public class LargeObjectManager
|
|||||||
// the fastpath api for this connection
|
// the fastpath api for this connection
|
||||||
private Fastpath fp;
|
private Fastpath fp;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This mode indicates we want to write to an object
|
* This mode indicates we want to write to an object
|
||||||
*/
|
*/
|
||||||
public static final int WRITE = 0x00020000;
|
public static final int WRITE = 0x00020000;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This mode indicates we want to read an object
|
* This mode indicates we want to read an object
|
||||||
*/
|
*/
|
||||||
public static final int READ = 0x00040000;
|
public static final int READ = 0x00040000;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This mode is the default. It indicates we want read and write access to
|
* This mode is the default. It indicates we want read and write access to
|
||||||
* a large object
|
* a large object
|
||||||
*/
|
*/
|
||||||
public static final int READWRITE = READ | WRITE;
|
public static final int READWRITE = READ | WRITE;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This prevents us being created by mere mortals
|
* This prevents us being created by mere mortals
|
||||||
*/
|
*/
|
||||||
private LargeObjectManager()
|
private LargeObjectManager()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructs the LargeObject API.
|
* Constructs the LargeObject API.
|
||||||
*
|
*
|
||||||
* <p><b>Important Notice</b>
|
* <p><b>Important Notice</b>
|
||||||
@ -120,7 +120,7 @@ public class LargeObjectManager
|
|||||||
DriverManager.println("Large Object initialised");
|
DriverManager.println("Large Object initialised");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This opens an existing large object, based on its OID. This method
|
* This opens an existing large object, based on its OID. This method
|
||||||
* assumes that READ and WRITE access is required (the default).
|
* assumes that READ and WRITE access is required (the default).
|
||||||
*
|
*
|
||||||
@ -133,7 +133,7 @@ public class LargeObjectManager
|
|||||||
return new LargeObject(fp, oid, READWRITE);
|
return new LargeObject(fp, oid, READWRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This opens an existing large object, based on its OID
|
* This opens an existing large object, based on its OID
|
||||||
*
|
*
|
||||||
* @param oid of large object
|
* @param oid of large object
|
||||||
@ -146,7 +146,7 @@ public class LargeObjectManager
|
|||||||
return new LargeObject(fp, oid, mode);
|
return new LargeObject(fp, oid, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This creates a large object, returning its OID.
|
* This creates a large object, returning its OID.
|
||||||
*
|
*
|
||||||
* <p>It defaults to READWRITE for the new object's attributes.
|
* <p>It defaults to READWRITE for the new object's attributes.
|
||||||
@ -161,7 +161,7 @@ public class LargeObjectManager
|
|||||||
return fp.getInteger("lo_creat", args);
|
return fp.getInteger("lo_creat", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This creates a large object, returning its OID
|
* This creates a large object, returning its OID
|
||||||
*
|
*
|
||||||
* @param mode a bitmask describing different attributes of the new object
|
* @param mode a bitmask describing different attributes of the new object
|
||||||
@ -175,7 +175,7 @@ public class LargeObjectManager
|
|||||||
return fp.getInteger("lo_creat", args);
|
return fp.getInteger("lo_creat", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This deletes a large object.
|
* This deletes a large object.
|
||||||
*
|
*
|
||||||
* @param oid describing object to delete
|
* @param oid describing object to delete
|
||||||
@ -188,7 +188,7 @@ public class LargeObjectManager
|
|||||||
fp.fastpath("lo_unlink", false, args);
|
fp.fastpath("lo_unlink", false, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This deletes a large object.
|
* This deletes a large object.
|
||||||
*
|
*
|
||||||
* <p>It is identical to the delete method, and is supplied as the C API uses
|
* <p>It is identical to the delete method, and is supplied as the C API uses
|
||||||
|
@ -16,11 +16,11 @@ import org.postgresql.Field;
|
|||||||
import org.postgresql.largeobject.*;
|
import org.postgresql.largeobject.*;
|
||||||
import org.postgresql.largeobject.*;
|
import org.postgresql.largeobject.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This implements the Blob interface, which is basically another way to
|
* This implements the Blob interface, which is basically another way to
|
||||||
* access a LargeObject.
|
* access a LargeObject.
|
||||||
*
|
*
|
||||||
* $Id: PGblob.java,v 1.2 2001/10/25 05:59:59 momjian Exp $
|
* $Id: PGblob.java,v 1.3 2001/11/19 22:33:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class PGblob implements java.sql.Blob
|
public class PGblob implements java.sql.Blob
|
||||||
|
@ -16,11 +16,11 @@ import org.postgresql.Field;
|
|||||||
import org.postgresql.largeobject.*;
|
import org.postgresql.largeobject.*;
|
||||||
import org.postgresql.largeobject.*;
|
import org.postgresql.largeobject.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This implements the Blob interface, which is basically another way to
|
* This implements the Blob interface, which is basically another way to
|
||||||
* access a LargeObject.
|
* access a LargeObject.
|
||||||
*
|
*
|
||||||
* $Id: PGclob.java,v 1.2 2001/10/25 05:59:59 momjian Exp $
|
* $Id: PGclob.java,v 1.3 2001/11/19 22:33:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class PGclob implements java.sql.Clob
|
public class PGclob implements java.sql.Clob
|
||||||
|
@ -6,12 +6,12 @@ import junit.framework.TestCase;
|
|||||||
import org.postgresql.test.jdbc2.*;
|
import org.postgresql.test.jdbc2.*;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Executes all known tests for JDBC2 and includes some utility methods.
|
* Executes all known tests for JDBC2 and includes some utility methods.
|
||||||
*/
|
*/
|
||||||
public class JDBC2Tests extends TestSuite
|
public class JDBC2Tests extends TestSuite
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* Returns the Test database JDBC URL
|
* Returns the Test database JDBC URL
|
||||||
*/
|
*/
|
||||||
public static String getURL()
|
public static String getURL()
|
||||||
@ -19,7 +19,7 @@ public class JDBC2Tests extends TestSuite
|
|||||||
return System.getProperty("database");
|
return System.getProperty("database");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the Postgresql username
|
* Returns the Postgresql username
|
||||||
*/
|
*/
|
||||||
public static String getUser()
|
public static String getUser()
|
||||||
@ -27,7 +27,7 @@ public class JDBC2Tests extends TestSuite
|
|||||||
return System.getProperty("username");
|
return System.getProperty("username");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the user's password
|
* Returns the user's password
|
||||||
*/
|
*/
|
||||||
public static String getPassword()
|
public static String getPassword()
|
||||||
@ -35,7 +35,7 @@ public class JDBC2Tests extends TestSuite
|
|||||||
return System.getProperty("password");
|
return System.getProperty("password");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper - opens a connection.
|
* Helper - opens a connection.
|
||||||
*/
|
*/
|
||||||
public static java.sql.Connection openDB()
|
public static java.sql.Connection openDB()
|
||||||
@ -56,7 +56,7 @@ public class JDBC2Tests extends TestSuite
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper - closes an open connection. This rewrites SQLException to a failed
|
* Helper - closes an open connection. This rewrites SQLException to a failed
|
||||||
* assertion. It's static so other classes can use it.
|
* assertion. It's static so other classes can use it.
|
||||||
*/
|
*/
|
||||||
@ -73,7 +73,7 @@ public class JDBC2Tests extends TestSuite
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper - creates a test table for use by a test
|
* Helper - creates a test table for use by a test
|
||||||
*/
|
*/
|
||||||
public static void createTable(Connection con,
|
public static void createTable(Connection con,
|
||||||
@ -102,7 +102,7 @@ public class JDBC2Tests extends TestSuite
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper - drops a table
|
* Helper - drops a table
|
||||||
*/
|
*/
|
||||||
public static void dropTable(Connection con, String table)
|
public static void dropTable(Connection con, String table)
|
||||||
@ -125,7 +125,7 @@ public class JDBC2Tests extends TestSuite
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper - generates INSERT SQL - very simple
|
* Helper - generates INSERT SQL - very simple
|
||||||
*/
|
*/
|
||||||
public static String insertSQL(String table, String values)
|
public static String insertSQL(String table, String values)
|
||||||
@ -143,7 +143,7 @@ public class JDBC2Tests extends TestSuite
|
|||||||
return s + " VALUES (" + values + ")";
|
return s + " VALUES (" + values + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper - generates SELECT SQL - very simple
|
* Helper - generates SELECT SQL - very simple
|
||||||
*/
|
*/
|
||||||
public static String selectSQL(String table, String columns)
|
public static String selectSQL(String table, String columns)
|
||||||
@ -168,7 +168,7 @@ public class JDBC2Tests extends TestSuite
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper to prefix a number with leading zeros - ugly but it works...
|
* Helper to prefix a number with leading zeros - ugly but it works...
|
||||||
* @param v value to prefix
|
* @param v value to prefix
|
||||||
* @param l number of digits (0-10)
|
* @param l number of digits (0-10)
|
||||||
@ -179,7 +179,7 @@ public class JDBC2Tests extends TestSuite
|
|||||||
return s.substring(s.length() - l);
|
return s.substring(s.length() - l);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The main entry point for JUnit
|
* The main entry point for JUnit
|
||||||
*/
|
*/
|
||||||
public static TestSuite suite()
|
public static TestSuite suite()
|
||||||
|
@ -172,7 +172,7 @@ import org.postgresql.test.JDBC2Tests;
|
|||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test case for ...
|
* Test case for ...
|
||||||
*/
|
*/
|
||||||
public class FooTest extends TestCase {
|
public class FooTest extends TestCase {
|
||||||
|
@ -9,7 +9,7 @@ public class ANTTest extends TestCase
|
|||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This tests the acceptsURL() method with a couple of good and badly formed
|
* This tests the acceptsURL() method with a couple of good and badly formed
|
||||||
* jdbc urls
|
* jdbc urls
|
||||||
*/
|
*/
|
||||||
|
@ -5,11 +5,11 @@ import junit.framework.TestCase;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/* TODO tests that can be added to this test case
|
/* TODO tests that can be added to this test case
|
||||||
- SQLExceptions chained to a BatchUpdateException
|
* - SQLExceptions chained to a BatchUpdateException
|
||||||
- test PreparedStatement as thoroughly as Statement
|
* - test PreparedStatement as thoroughly as Statement
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test case for Statement.batchExecute()
|
* Test case for Statement.batchExecute()
|
||||||
*/
|
*/
|
||||||
public class BatchExecuteTest extends TestCase
|
public class BatchExecuteTest extends TestCase
|
||||||
@ -166,8 +166,6 @@ public class BatchExecuteTest extends TestCase
|
|||||||
pstmt.close();
|
pstmt.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public void testTransactionalBehaviour() throws Exception
|
public void testTransactionalBehaviour() throws Exception
|
||||||
{
|
{
|
||||||
Statement stmt = con.createStatement();
|
Statement stmt = con.createStatement();
|
||||||
|
@ -7,8 +7,8 @@ import java.sql.*;
|
|||||||
|
|
||||||
import org.postgresql.largeobject.*;
|
import org.postgresql.largeobject.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* $Id: BlobTest.java,v 1.3 2001/10/25 05:59:59 momjian Exp $
|
* $Id: BlobTest.java,v 1.4 2001/11/19 22:33:39 momjian Exp $
|
||||||
*
|
*
|
||||||
* Some simple tests based on problems reported by users. Hopefully these will
|
* Some simple tests based on problems reported by users. Hopefully these will
|
||||||
* help prevent previous problems from re-occuring ;-)
|
* help prevent previous problems from re-occuring ;-)
|
||||||
@ -40,7 +40,7 @@ public class BlobTest extends TestCase
|
|||||||
JDBC2Tests.closeDB(con);
|
JDBC2Tests.closeDB(con);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests one method of uploading a blob to the database
|
* Tests one method of uploading a blob to the database
|
||||||
*/
|
*/
|
||||||
public void testUploadBlob_LOOP()
|
public void testUploadBlob_LOOP()
|
||||||
@ -64,7 +64,7 @@ public class BlobTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests one method of uploading a blob to the database
|
* Tests one method of uploading a blob to the database
|
||||||
*/
|
*/
|
||||||
public void testUploadBlob_NATIVE()
|
public void testUploadBlob_NATIVE()
|
||||||
@ -88,7 +88,7 @@ public class BlobTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper - uploads a file into a blob using old style methods. We use this
|
* Helper - uploads a file into a blob using old style methods. We use this
|
||||||
* because it always works, and we can use it as a base to test the new
|
* because it always works, and we can use it as a base to test the new
|
||||||
* methods.
|
* methods.
|
||||||
@ -152,7 +152,7 @@ public class BlobTest extends TestCase
|
|||||||
return oid;
|
return oid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper - compares the blobs in a table with a local file. Note this alone
|
* Helper - compares the blobs in a table with a local file. Note this alone
|
||||||
* tests the InputStream methods!
|
* tests the InputStream methods!
|
||||||
*/
|
*/
|
||||||
|
@ -4,19 +4,19 @@ import org.postgresql.test.JDBC2Tests;
|
|||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* TestCase to test the internal functionality of org.postgresql.jdbc2.Connection
|
* TestCase to test the internal functionality of org.postgresql.jdbc2.Connection
|
||||||
* and it's superclass.
|
* and it's superclass.
|
||||||
*
|
*
|
||||||
* PS: Do you know how difficult it is to type on a train? ;-)
|
* PS: Do you know how difficult it is to type on a train? ;-)
|
||||||
*
|
*
|
||||||
* $Id: ConnectionTest.java,v 1.6 2001/10/25 05:59:59 momjian Exp $
|
* $Id: ConnectionTest.java,v 1.7 2001/11/19 22:33:39 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ConnectionTest extends TestCase
|
public class ConnectionTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public ConnectionTest(String name)
|
public ConnectionTest(String name)
|
||||||
@ -46,7 +46,7 @@ public class ConnectionTest extends TestCase
|
|||||||
JDBC2Tests.closeDB(con);
|
JDBC2Tests.closeDB(con);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests the two forms of createStatement()
|
* Tests the two forms of createStatement()
|
||||||
*/
|
*/
|
||||||
public void testCreateStatement()
|
public void testCreateStatement()
|
||||||
@ -72,7 +72,7 @@ public class ConnectionTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests the two forms of prepareStatement()
|
* Tests the two forms of prepareStatement()
|
||||||
*/
|
*/
|
||||||
public void testPrepareStatement()
|
public void testPrepareStatement()
|
||||||
@ -100,13 +100,13 @@ public class ConnectionTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Put the test for createPrepareCall here
|
* Put the test for createPrepareCall here
|
||||||
*/
|
*/
|
||||||
public void testPrepareCall()
|
public void testPrepareCall()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test nativeSQL
|
* Test nativeSQL
|
||||||
*/
|
*/
|
||||||
public void testNativeSQL()
|
public void testNativeSQL()
|
||||||
@ -114,7 +114,7 @@ public class ConnectionTest extends TestCase
|
|||||||
// For now do nothing as it returns itself
|
// For now do nothing as it returns itself
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test autoCommit (both get & set)
|
* Test autoCommit (both get & set)
|
||||||
*/
|
*/
|
||||||
public void testTransactions()
|
public void testTransactions()
|
||||||
@ -163,7 +163,7 @@ public class ConnectionTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Simple test to see if isClosed works.
|
* Simple test to see if isClosed works.
|
||||||
*/
|
*/
|
||||||
public void testIsClosed()
|
public void testIsClosed()
|
||||||
@ -187,7 +187,7 @@ public class ConnectionTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test the warnings system
|
* Test the warnings system
|
||||||
*/
|
*/
|
||||||
public void testWarnings()
|
public void testWarnings()
|
||||||
@ -224,7 +224,7 @@ public class ConnectionTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Transaction Isolation Levels
|
* Transaction Isolation Levels
|
||||||
*/
|
*/
|
||||||
public void testTransactionIsolation()
|
public void testTransactionIsolation()
|
||||||
@ -309,7 +309,7 @@ public class ConnectionTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* JDBC2 Type mappings
|
* JDBC2 Type mappings
|
||||||
*/
|
*/
|
||||||
public void testTypeMaps()
|
public void testTypeMaps()
|
||||||
|
@ -4,18 +4,18 @@ import org.postgresql.test.JDBC2Tests;
|
|||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* TestCase to test the internal functionality of org.postgresql.jdbc2.DatabaseMetaData
|
* TestCase to test the internal functionality of org.postgresql.jdbc2.DatabaseMetaData
|
||||||
*
|
*
|
||||||
* PS: Do you know how difficult it is to type on a train? ;-)
|
* PS: Do you know how difficult it is to type on a train? ;-)
|
||||||
*
|
*
|
||||||
* $Id: DatabaseMetaDataTest.java,v 1.3 2001/10/25 05:59:59 momjian Exp $
|
* $Id: DatabaseMetaDataTest.java,v 1.4 2001/11/19 22:33:39 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class DatabaseMetaDataTest extends TestCase
|
public class DatabaseMetaDataTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public DatabaseMetaDataTest(String name)
|
public DatabaseMetaDataTest(String name)
|
||||||
@ -23,7 +23,7 @@ public class DatabaseMetaDataTest extends TestCase
|
|||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The spec says this may return null, but we always do!
|
* The spec says this may return null, but we always do!
|
||||||
*/
|
*/
|
||||||
public void testGetMetaData()
|
public void testGetMetaData()
|
||||||
@ -43,7 +43,7 @@ public class DatabaseMetaDataTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test default capabilities
|
* Test default capabilities
|
||||||
*/
|
*/
|
||||||
public void testCapabilities()
|
public void testCapabilities()
|
||||||
|
@ -4,8 +4,8 @@ import org.postgresql.test.JDBC2Tests;
|
|||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* $Id: DateTest.java,v 1.3 2001/10/25 05:59:59 momjian Exp $
|
* $Id: DateTest.java,v 1.4 2001/11/19 22:33:39 momjian Exp $
|
||||||
*
|
*
|
||||||
* Some simple tests based on problems reported by users. Hopefully these will
|
* Some simple tests based on problems reported by users. Hopefully these will
|
||||||
* help prevent previous problems from re-occuring ;-)
|
* help prevent previous problems from re-occuring ;-)
|
||||||
@ -33,7 +33,7 @@ public class DateTest extends TestCase
|
|||||||
JDBC2Tests.closeDB(con);
|
JDBC2Tests.closeDB(con);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests the time methods in ResultSet
|
* Tests the time methods in ResultSet
|
||||||
*/
|
*/
|
||||||
public void testGetDate()
|
public void testGetDate()
|
||||||
@ -59,7 +59,7 @@ public class DateTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests the time methods in PreparedStatement
|
* Tests the time methods in PreparedStatement
|
||||||
*/
|
*/
|
||||||
public void testSetDate()
|
public void testSetDate()
|
||||||
@ -95,7 +95,7 @@ public class DateTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper for the date tests. It tests what should be in the db
|
* Helper for the date tests. It tests what should be in the db
|
||||||
*/
|
*/
|
||||||
private void dateTest() throws SQLException
|
private void dateTest() throws SQLException
|
||||||
|
@ -4,8 +4,8 @@ import org.postgresql.test.JDBC2Tests;
|
|||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* $Id: DriverTest.java,v 1.3 2001/10/25 05:59:59 momjian Exp $
|
* $Id: DriverTest.java,v 1.4 2001/11/19 22:33:39 momjian Exp $
|
||||||
*
|
*
|
||||||
* Tests the dynamically created class org.postgresql.Driver
|
* Tests the dynamically created class org.postgresql.Driver
|
||||||
*
|
*
|
||||||
@ -18,7 +18,7 @@ public class DriverTest extends TestCase
|
|||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This tests the acceptsURL() method with a couple of good and badly formed
|
* This tests the acceptsURL() method with a couple of good and badly formed
|
||||||
* jdbc urls
|
* jdbc urls
|
||||||
*/
|
*/
|
||||||
@ -49,10 +49,10 @@ public class DriverTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests parseURL (internal)
|
* Tests parseURL (internal)
|
||||||
*/
|
*/
|
||||||
/**
|
/*
|
||||||
* Tests the connect method by connecting to the test database
|
* Tests the connect method by connecting to the test database
|
||||||
*/
|
*/
|
||||||
public void testConnect()
|
public void testConnect()
|
||||||
|
@ -5,10 +5,10 @@ import junit.framework.*;
|
|||||||
import org.postgresql.core.Encoding;
|
import org.postgresql.core.Encoding;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests for the Encoding class.
|
* Tests for the Encoding class.
|
||||||
*
|
*
|
||||||
* $Id: EncodingTest.java,v 1.3 2001/10/25 05:59:59 momjian Exp $
|
* $Id: EncodingTest.java,v 1.4 2001/11/19 22:33:39 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ import junit.framework.TestCase;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* $Id: JBuilderTest.java,v 1.4 2001/10/25 05:59:59 momjian Exp $
|
* $Id: JBuilderTest.java,v 1.5 2001/11/19 22:33:39 momjian Exp $
|
||||||
*
|
*
|
||||||
* Some simple tests to check that the required components needed for JBuilder
|
* Some simple tests to check that the required components needed for JBuilder
|
||||||
* stay working
|
* stay working
|
||||||
@ -39,7 +39,7 @@ public class JBuilderTest extends TestCase
|
|||||||
JDBC2Tests.closeDB(con);
|
JDBC2Tests.closeDB(con);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This tests that Money types work. JDBCExplorer barfs if this fails.
|
* This tests that Money types work. JDBCExplorer barfs if this fails.
|
||||||
*/
|
*/
|
||||||
public void testMoney()
|
public void testMoney()
|
||||||
|
@ -4,8 +4,8 @@ import org.postgresql.test.JDBC2Tests;
|
|||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* $Id: MiscTest.java,v 1.3 2001/10/25 05:59:59 momjian Exp $
|
* $Id: MiscTest.java,v 1.4 2001/11/19 22:33:39 momjian Exp $
|
||||||
*
|
*
|
||||||
* Some simple tests based on problems reported by users. Hopefully these will
|
* Some simple tests based on problems reported by users. Hopefully these will
|
||||||
* help prevent previous problems from re-occuring ;-)
|
* help prevent previous problems from re-occuring ;-)
|
||||||
@ -19,7 +19,7 @@ public class MiscTest extends TestCase
|
|||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Some versions of the driver would return rs as a null?
|
* Some versions of the driver would return rs as a null?
|
||||||
*
|
*
|
||||||
* Sasha <ber0806@iperbole.bologna.it> was having this problem.
|
* Sasha <ber0806@iperbole.bologna.it> was having this problem.
|
||||||
|
@ -5,7 +5,7 @@ import junit.framework.TestCase;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* ResultSet tests.
|
* ResultSet tests.
|
||||||
*/
|
*/
|
||||||
public class ResultSetTest extends TestCase
|
public class ResultSetTest extends TestCase
|
||||||
|
@ -4,8 +4,8 @@ import org.postgresql.test.JDBC2Tests;
|
|||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* $Id: TimeTest.java,v 1.3 2001/10/25 05:59:59 momjian Exp $
|
* $Id: TimeTest.java,v 1.4 2001/11/19 22:33:39 momjian Exp $
|
||||||
*
|
*
|
||||||
* Some simple tests based on problems reported by users. Hopefully these will
|
* Some simple tests based on problems reported by users. Hopefully these will
|
||||||
* help prevent previous problems from re-occuring ;-)
|
* help prevent previous problems from re-occuring ;-)
|
||||||
@ -33,7 +33,7 @@ public class TimeTest extends TestCase
|
|||||||
JDBC2Tests.closeDB(con);
|
JDBC2Tests.closeDB(con);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests the time methods in ResultSet
|
* Tests the time methods in ResultSet
|
||||||
*/
|
*/
|
||||||
public void testGetTime()
|
public void testGetTime()
|
||||||
@ -57,7 +57,7 @@ public class TimeTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests the time methods in PreparedStatement
|
* Tests the time methods in PreparedStatement
|
||||||
*/
|
*/
|
||||||
public void testSetTime()
|
public void testSetTime()
|
||||||
@ -86,7 +86,7 @@ public class TimeTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper for the TimeTests. It tests what should be in the db
|
* Helper for the TimeTests. It tests what should be in the db
|
||||||
*/
|
*/
|
||||||
private void timeTest() throws SQLException
|
private void timeTest() throws SQLException
|
||||||
|
@ -4,8 +4,8 @@ import org.postgresql.test.JDBC2Tests;
|
|||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* $Id: TimestampTest.java,v 1.5 2001/10/25 05:59:59 momjian Exp $
|
* $Id: TimestampTest.java,v 1.6 2001/11/19 22:33:39 momjian Exp $
|
||||||
*
|
*
|
||||||
* This has been the most controversial pair of methods since 6.5 was released!
|
* This has been the most controversial pair of methods since 6.5 was released!
|
||||||
*
|
*
|
||||||
@ -37,7 +37,7 @@ public class TimestampTest extends TestCase
|
|||||||
JDBC2Tests.closeDB(con);
|
JDBC2Tests.closeDB(con);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests the time methods in ResultSet
|
* Tests the time methods in ResultSet
|
||||||
*/
|
*/
|
||||||
public void testGetTimestamp()
|
public void testGetTimestamp()
|
||||||
@ -69,7 +69,7 @@ public class TimestampTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests the time methods in PreparedStatement
|
* Tests the time methods in PreparedStatement
|
||||||
*/
|
*/
|
||||||
public void testSetTimestamp()
|
public void testSetTimestamp()
|
||||||
@ -102,7 +102,7 @@ public class TimestampTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper for the TimeTests. It tests what should be in the db
|
* Helper for the TimeTests. It tests what should be in the db
|
||||||
*/
|
*/
|
||||||
private void timestampTest() throws SQLException
|
private void timestampTest() throws SQLException
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package org.postgresql.util;
|
package org.postgresql.util;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* MD5-based utility function to obfuscate passwords before network transmission
|
* MD5-based utility function to obfuscate passwords before network transmission
|
||||||
*
|
*
|
||||||
* @author Jeremy Wohl
|
* @author Jeremy Wohl
|
||||||
@ -11,10 +11,11 @@ import java.security.*;
|
|||||||
|
|
||||||
public class MD5Digest
|
public class MD5Digest
|
||||||
{
|
{
|
||||||
private MD5Digest() {}
|
private MD5Digest()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Encodes user/password/salt information in the following way:
|
* Encodes user/password/salt information in the following way:
|
||||||
* MD5(MD5(password + user) + salt)
|
* MD5(MD5(password + user) + salt)
|
||||||
*
|
*
|
||||||
@ -30,8 +31,8 @@ public class MD5Digest
|
|||||||
byte[] temp_digest, pass_digest;
|
byte[] temp_digest, pass_digest;
|
||||||
byte[] hex_digest = new byte[35];
|
byte[] hex_digest = new byte[35];
|
||||||
|
|
||||||
|
try
|
||||||
try {
|
{
|
||||||
md = MessageDigest.getInstance("MD5");
|
md = MessageDigest.getInstance("MD5");
|
||||||
|
|
||||||
md.update(password.getBytes());
|
md.update(password.getBytes());
|
||||||
@ -44,8 +45,12 @@ public class MD5Digest
|
|||||||
pass_digest = md.digest();
|
pass_digest = md.digest();
|
||||||
|
|
||||||
bytesToHex(pass_digest, hex_digest, 3);
|
bytesToHex(pass_digest, hex_digest, 3);
|
||||||
hex_digest[0] = (byte) 'm'; hex_digest[1] = (byte) 'd'; hex_digest[2] = (byte) '5';
|
hex_digest[0] = (byte) 'm';
|
||||||
} catch (Exception e) {
|
hex_digest[1] = (byte) 'd';
|
||||||
|
hex_digest[2] = (byte) '5';
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
; // "MessageDigest failure; " + e
|
; // "MessageDigest failure; " + e
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +58,7 @@ public class MD5Digest
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Turn 16-byte stream into a human-readable 32-byte hex string
|
* Turn 16-byte stream into a human-readable 32-byte hex string
|
||||||
*/
|
*/
|
||||||
private static void bytesToHex(byte[] bytes, byte[] hex, int offset)
|
private static void bytesToHex(byte[] bytes, byte[] hex, int offset)
|
||||||
@ -63,8 +68,10 @@ public class MD5Digest
|
|||||||
|
|
||||||
int i, c, j, pos = offset;
|
int i, c, j, pos = offset;
|
||||||
|
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++)
|
||||||
c = bytes[i] & 0xFF; j = c >> 4;
|
{
|
||||||
|
c = bytes[i] & 0xFF;
|
||||||
|
j = c >> 4;
|
||||||
hex[pos++] = (byte) lookup[j];
|
hex[pos++] = (byte) lookup[j];
|
||||||
j = (c & 0xF);
|
j = (c & 0xF);
|
||||||
hex[pos++] = (byte) lookup[j];
|
hex[pos++] = (byte) lookup[j];
|
||||||
|
@ -3,7 +3,7 @@ package org.postgresql.util;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.text.*;
|
import java.text.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A singleton class to translate JDBC driver messages in SQLException's.
|
* A singleton class to translate JDBC driver messages in SQLException's.
|
||||||
*/
|
*/
|
||||||
public class MessageTranslator
|
public class MessageTranslator
|
||||||
|
@ -2,16 +2,16 @@ package org.postgresql.util;
|
|||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Converts to and from the postgresql bytea datatype used by the backend.
|
* Converts to and from the postgresql bytea datatype used by the backend.
|
||||||
*
|
*
|
||||||
* $Id: PGbytea.java,v 1.2 2001/10/25 06:00:00 momjian Exp $
|
* $Id: PGbytea.java,v 1.3 2001/11/19 22:33:39 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PGbytea
|
public class PGbytea
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Converts a PG bytea string (i.e. the text representation
|
* Converts a PG bytea string (i.e. the text representation
|
||||||
* of the bytea data type) into a java byte[]
|
* of the bytea data type) into a java byte[]
|
||||||
*/
|
*/
|
||||||
@ -54,7 +54,7 @@ public class PGbytea
|
|||||||
return l_return;
|
return l_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Converts a java byte[] into a PG bytea string (i.e. the text
|
* Converts a java byte[] into a PG bytea string (i.e. the text
|
||||||
* representation of the bytea data type)
|
* representation of the bytea data type)
|
||||||
*/
|
*/
|
||||||
|
@ -3,17 +3,17 @@ package org.postgresql.util;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This implements a class that handles the PostgreSQL money and cash types
|
* This implements a class that handles the PostgreSQL money and cash types
|
||||||
*/
|
*/
|
||||||
public class PGmoney extends PGobject implements Serializable, Cloneable
|
public class PGmoney extends PGobject implements Serializable, Cloneable
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* The value of the field
|
* The value of the field
|
||||||
*/
|
*/
|
||||||
public double val;
|
public double val;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param value of field
|
* @param value of field
|
||||||
*/
|
*/
|
||||||
public PGmoney(double value)
|
public PGmoney(double value)
|
||||||
@ -22,7 +22,7 @@ public class PGmoney extends PGobject implements Serializable, Cloneable
|
|||||||
val = value;
|
val = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This is called mainly from the other geometric types, when a
|
* This is called mainly from the other geometric types, when a
|
||||||
* point is imbeded within their definition.
|
* point is imbeded within their definition.
|
||||||
*
|
*
|
||||||
@ -34,7 +34,7 @@ public class PGmoney extends PGobject implements Serializable, Cloneable
|
|||||||
setValue(value);
|
setValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Required by the driver
|
* Required by the driver
|
||||||
*/
|
*/
|
||||||
public PGmoney()
|
public PGmoney()
|
||||||
@ -42,7 +42,7 @@ public class PGmoney extends PGobject implements Serializable, Cloneable
|
|||||||
setType("money");
|
setType("money");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param s Definition of this point in PostgreSQL's syntax
|
* @param s Definition of this point in PostgreSQL's syntax
|
||||||
* @exception SQLException on conversion failure
|
* @exception SQLException on conversion failure
|
||||||
*/
|
*/
|
||||||
@ -76,7 +76,7 @@ public class PGmoney extends PGobject implements Serializable, Cloneable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param obj Object to compare with
|
* @param obj Object to compare with
|
||||||
* @return true if the two boxes are identical
|
* @return true if the two boxes are identical
|
||||||
*/
|
*/
|
||||||
@ -90,7 +90,7 @@ public class PGmoney extends PGobject implements Serializable, Cloneable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This must be overidden to allow the object to be cloned
|
* This must be overidden to allow the object to be cloned
|
||||||
*/
|
*/
|
||||||
public Object clone()
|
public Object clone()
|
||||||
@ -98,7 +98,7 @@ public class PGmoney extends PGobject implements Serializable, Cloneable
|
|||||||
return new PGmoney(val);
|
return new PGmoney(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the PGpoint in the syntax expected by org.postgresql
|
* @return the PGpoint in the syntax expected by org.postgresql
|
||||||
*/
|
*/
|
||||||
public String getValue()
|
public String getValue()
|
||||||
|
@ -5,7 +5,7 @@ import java.lang.*;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* org.postgresql.PG_Object is a class used to describe unknown types
|
* org.postgresql.PG_Object is a class used to describe unknown types
|
||||||
* An unknown type is any type that is unknown by JDBC Standards
|
* An unknown type is any type that is unknown by JDBC Standards
|
||||||
*
|
*
|
||||||
@ -18,14 +18,14 @@ public class PGobject implements Serializable, Cloneable
|
|||||||
protected String type;
|
protected String type;
|
||||||
protected String value;
|
protected String value;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This is called by org.postgresql.Connection.getObject() to create the
|
* This is called by org.postgresql.Connection.getObject() to create the
|
||||||
* object.
|
* object.
|
||||||
*/
|
*/
|
||||||
public PGobject()
|
public PGobject()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This method sets the type of this object.
|
* This method sets the type of this object.
|
||||||
*
|
*
|
||||||
* <p>It should not be extended by subclasses, hence its final
|
* <p>It should not be extended by subclasses, hence its final
|
||||||
@ -37,7 +37,7 @@ public class PGobject implements Serializable, Cloneable
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This method sets the value of this object. It must be overidden.
|
* This method sets the value of this object. It must be overidden.
|
||||||
*
|
*
|
||||||
* @param value a string representation of the value of the object
|
* @param value a string representation of the value of the object
|
||||||
@ -48,7 +48,7 @@ public class PGobject implements Serializable, Cloneable
|
|||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* As this cannot change during the life of the object, it's final.
|
* As this cannot change during the life of the object, it's final.
|
||||||
* @return the type name of this object
|
* @return the type name of this object
|
||||||
*/
|
*/
|
||||||
@ -57,7 +57,7 @@ public class PGobject implements Serializable, Cloneable
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This must be overidden, to return the value of the object, in the
|
* This must be overidden, to return the value of the object, in the
|
||||||
* form required by org.postgresql.
|
* form required by org.postgresql.
|
||||||
* @return the value of this object
|
* @return the value of this object
|
||||||
@ -67,7 +67,7 @@ public class PGobject implements Serializable, Cloneable
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This must be overidden to allow comparisons of objects
|
* This must be overidden to allow comparisons of objects
|
||||||
* @param obj Object to compare with
|
* @param obj Object to compare with
|
||||||
* @return true if the two boxes are identical
|
* @return true if the two boxes are identical
|
||||||
@ -79,7 +79,7 @@ public class PGobject implements Serializable, Cloneable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This must be overidden to allow the object to be cloned
|
* This must be overidden to allow the object to be cloned
|
||||||
*/
|
*/
|
||||||
public Object clone()
|
public Object clone()
|
||||||
@ -90,7 +90,7 @@ public class PGobject implements Serializable, Cloneable
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This is defined here, so user code need not overide it.
|
* This is defined here, so user code need not overide it.
|
||||||
* @return the value of this object, in the syntax expected by org.postgresql
|
* @return the value of this object, in the syntax expected by org.postgresql
|
||||||
*/
|
*/
|
||||||
|
@ -3,7 +3,7 @@ package org.postgresql.util;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This class is used to tokenize the text output of org.postgres.
|
* This class is used to tokenize the text output of org.postgres.
|
||||||
*
|
*
|
||||||
* <p>It's mainly used by the geometric classes, but is useful in parsing any
|
* <p>It's mainly used by the geometric classes, but is useful in parsing any
|
||||||
@ -21,7 +21,7 @@ public class PGtokenizer
|
|||||||
// Our tokens
|
// Our tokens
|
||||||
protected Vector tokens;
|
protected Vector tokens;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Create a tokeniser.
|
* Create a tokeniser.
|
||||||
*
|
*
|
||||||
* <p>We could have used StringTokenizer to do this, however, we needed to
|
* <p>We could have used StringTokenizer to do this, however, we needed to
|
||||||
@ -36,7 +36,7 @@ public class PGtokenizer
|
|||||||
tokenize(string, delim);
|
tokenize(string, delim);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This resets this tokenizer with a new string and/or delimiter.
|
* This resets this tokenizer with a new string and/or delimiter.
|
||||||
*
|
*
|
||||||
* @param string containing tokens
|
* @param string containing tokens
|
||||||
@ -83,7 +83,7 @@ public class PGtokenizer
|
|||||||
return tokens.size();
|
return tokens.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @return the number of tokens available
|
* @return the number of tokens available
|
||||||
*/
|
*/
|
||||||
public int getSize()
|
public int getSize()
|
||||||
@ -91,7 +91,7 @@ public class PGtokenizer
|
|||||||
return tokens.size();
|
return tokens.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param n Token number ( 0 ... getSize()-1 )
|
* @param n Token number ( 0 ... getSize()-1 )
|
||||||
* @return The token value
|
* @return The token value
|
||||||
*/
|
*/
|
||||||
@ -100,7 +100,7 @@ public class PGtokenizer
|
|||||||
return (String)tokens.elementAt(n);
|
return (String)tokens.elementAt(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This returns a new tokenizer based on one of our tokens.
|
* This returns a new tokenizer based on one of our tokens.
|
||||||
*
|
*
|
||||||
* The geometric datatypes use this to process nested tokens (usually
|
* The geometric datatypes use this to process nested tokens (usually
|
||||||
@ -115,7 +115,7 @@ public class PGtokenizer
|
|||||||
return new PGtokenizer(getToken(n), delim);
|
return new PGtokenizer(getToken(n), delim);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This removes the lead/trailing strings from a string
|
* This removes the lead/trailing strings from a string
|
||||||
* @param s Source string
|
* @param s Source string
|
||||||
* @param l Leading string to remove
|
* @param l Leading string to remove
|
||||||
@ -131,7 +131,7 @@ public class PGtokenizer
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This removes the lead/trailing strings from all tokens
|
* This removes the lead/trailing strings from all tokens
|
||||||
* @param l Leading string to remove
|
* @param l Leading string to remove
|
||||||
* @param t Trailing string to remove
|
* @param t Trailing string to remove
|
||||||
@ -144,7 +144,7 @@ public class PGtokenizer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Removes ( and ) from the beginning and end of a string
|
* Removes ( and ) from the beginning and end of a string
|
||||||
* @param s String to remove from
|
* @param s String to remove from
|
||||||
* @return String without the ( or )
|
* @return String without the ( or )
|
||||||
@ -154,7 +154,7 @@ public class PGtokenizer
|
|||||||
return remove(s, "(", ")");
|
return remove(s, "(", ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Removes ( and ) from the beginning and end of all tokens
|
* Removes ( and ) from the beginning and end of all tokens
|
||||||
* @return String without the ( or )
|
* @return String without the ( or )
|
||||||
*/
|
*/
|
||||||
@ -163,7 +163,7 @@ public class PGtokenizer
|
|||||||
remove("(", ")");
|
remove("(", ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Removes [ and ] from the beginning and end of a string
|
* Removes [ and ] from the beginning and end of a string
|
||||||
* @param s String to remove from
|
* @param s String to remove from
|
||||||
* @return String without the [ or ]
|
* @return String without the [ or ]
|
||||||
@ -173,7 +173,7 @@ public class PGtokenizer
|
|||||||
return remove(s, "[", "]");
|
return remove(s, "[", "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Removes [ and ] from the beginning and end of all tokens
|
* Removes [ and ] from the beginning and end of all tokens
|
||||||
* @return String without the [ or ]
|
* @return String without the [ or ]
|
||||||
*/
|
*/
|
||||||
@ -182,7 +182,7 @@ public class PGtokenizer
|
|||||||
remove("[", "]");
|
remove("[", "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Removes < and > from the beginning and end of a string
|
* Removes < and > from the beginning and end of a string
|
||||||
* @param s String to remove from
|
* @param s String to remove from
|
||||||
* @return String without the < or >
|
* @return String without the < or >
|
||||||
@ -192,7 +192,7 @@ public class PGtokenizer
|
|||||||
return remove(s, "<", ">");
|
return remove(s, "<", ">");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Removes < and > from the beginning and end of all tokens
|
* Removes < and > from the beginning and end of all tokens
|
||||||
* @return String without the < or >
|
* @return String without the < or >
|
||||||
*/
|
*/
|
||||||
|
@ -3,14 +3,14 @@ package org.postgresql.util;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This class extends SQLException, and provides our internationalisation handling
|
* This class extends SQLException, and provides our internationalisation handling
|
||||||
*/
|
*/
|
||||||
public class PSQLException extends SQLException
|
public class PSQLException extends SQLException
|
||||||
{
|
{
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This provides the same functionality to SQLException
|
* This provides the same functionality to SQLException
|
||||||
* @param error Error string
|
* @param error Error string
|
||||||
*/
|
*/
|
||||||
@ -20,7 +20,7 @@ public class PSQLException extends SQLException
|
|||||||
translate(error, null);
|
translate(error, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A more generic entry point.
|
* A more generic entry point.
|
||||||
* @param error Error string or standard message id
|
* @param error Error string or standard message id
|
||||||
* @param args Array of arguments
|
* @param args Array of arguments
|
||||||
@ -31,7 +31,7 @@ public class PSQLException extends SQLException
|
|||||||
translate(error, args);
|
translate(error, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper version for 1 arg
|
* Helper version for 1 arg
|
||||||
*/
|
*/
|
||||||
public PSQLException(String error, Object arg)
|
public PSQLException(String error, Object arg)
|
||||||
@ -42,7 +42,7 @@ public class PSQLException extends SQLException
|
|||||||
translate(error, argv);
|
translate(error, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper version for 1 arg. This is used for debug purposes only with
|
* Helper version for 1 arg. This is used for debug purposes only with
|
||||||
* some unusual Exception's. It allows the originiating Exceptions stack
|
* some unusual Exception's. It allows the originiating Exceptions stack
|
||||||
* trace to be returned.
|
* trace to be returned.
|
||||||
@ -73,7 +73,7 @@ public class PSQLException extends SQLException
|
|||||||
translate(error, argv);
|
translate(error, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Helper version for 2 args
|
* Helper version for 2 args
|
||||||
*/
|
*/
|
||||||
public PSQLException(String error, Object arg1, Object arg2)
|
public PSQLException(String error, Object arg1, Object arg2)
|
||||||
@ -90,7 +90,7 @@ public class PSQLException extends SQLException
|
|||||||
message = MessageTranslator.translate(error, args);
|
message = MessageTranslator.translate(error, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Overides Throwable
|
* Overides Throwable
|
||||||
*/
|
*/
|
||||||
public String getLocalizedMessage()
|
public String getLocalizedMessage()
|
||||||
@ -98,7 +98,7 @@ public class PSQLException extends SQLException
|
|||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Overides Throwable
|
* Overides Throwable
|
||||||
*/
|
*/
|
||||||
public String getMessage()
|
public String getMessage()
|
||||||
@ -106,7 +106,7 @@ public class PSQLException extends SQLException
|
|||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Overides Object
|
* Overides Object
|
||||||
*/
|
*/
|
||||||
public String toString()
|
public String toString()
|
||||||
|
@ -7,7 +7,7 @@ import java.net.*;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This class uses PostgreSQL's object oriented features to store Java Objects.<p>
|
* This class uses PostgreSQL's object oriented features to store Java Objects.<p>
|
||||||
*
|
*
|
||||||
* It does this by mapping a Java Class name to a table in the database. Each
|
* It does this by mapping a Java Class name to a table in the database. Each
|
||||||
@ -119,7 +119,7 @@ public class Serialize
|
|||||||
// This is the Class for this serialzed object
|
// This is the Class for this serialzed object
|
||||||
protected Class ourClass;
|
protected Class ourClass;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This creates an instance that can be used to serialize or deserialize
|
* This creates an instance that can be used to serialize or deserialize
|
||||||
* a Java object from a PostgreSQL table.
|
* a Java object from a PostgreSQL table.
|
||||||
*/
|
*/
|
||||||
@ -160,7 +160,7 @@ public class Serialize
|
|||||||
// Finally cache the fields within the table
|
// Finally cache the fields within the table
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructor when Object is passed in
|
* Constructor when Object is passed in
|
||||||
*/
|
*/
|
||||||
public Serialize(org.postgresql.Connection c, Object o) throws SQLException
|
public Serialize(org.postgresql.Connection c, Object o) throws SQLException
|
||||||
@ -168,7 +168,7 @@ public class Serialize
|
|||||||
this(c, o.getClass().getName());
|
this(c, o.getClass().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Constructor when Class is passed in
|
* Constructor when Class is passed in
|
||||||
*/
|
*/
|
||||||
public Serialize(org.postgresql.Connection c, Class cls) throws SQLException
|
public Serialize(org.postgresql.Connection c, Class cls) throws SQLException
|
||||||
@ -176,7 +176,7 @@ public class Serialize
|
|||||||
this(c, cls.getName());
|
this(c, cls.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This fetches an object from a table, given it's OID
|
* This fetches an object from a table, given it's OID
|
||||||
* @param oid The oid of the object
|
* @param oid The oid of the object
|
||||||
* @return Object relating to oid
|
* @return Object relating to oid
|
||||||
@ -267,7 +267,7 @@ public class Serialize
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This stores an object into a table, returning it's OID.<p>
|
* This stores an object into a table, returning it's OID.<p>
|
||||||
*
|
*
|
||||||
* If the object has an int called OID, and it is > 0, then
|
* If the object has an int called OID, and it is > 0, then
|
||||||
@ -406,7 +406,7 @@ public class Serialize
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Escape literal single quote and backslashes embedded in strings/chars.
|
* Escape literal single quote and backslashes embedded in strings/chars.
|
||||||
* Otherwise, postgres will bomb on the single quote and remove the
|
* Otherwise, postgres will bomb on the single quote and remove the
|
||||||
* the backslashes.
|
* the backslashes.
|
||||||
@ -451,7 +451,7 @@ public class Serialize
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This method is not used by the driver, but it creates a table, given
|
* This method is not used by the driver, but it creates a table, given
|
||||||
* a Serializable Java Object. It should be used before serializing any
|
* a Serializable Java Object. It should be used before serializing any
|
||||||
* objects.
|
* objects.
|
||||||
@ -464,7 +464,7 @@ public class Serialize
|
|||||||
create(con, o.getClass());
|
create(con, o.getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This method is not used by the driver, but it creates a table, given
|
* This method is not used by the driver, but it creates a table, given
|
||||||
* a Serializable Java Object. It should be used before serializing any
|
* a Serializable Java Object. It should be used before serializing any
|
||||||
* objects.
|
* objects.
|
||||||
@ -558,7 +558,7 @@ public class Serialize
|
|||||||
{"byte", "int2"}
|
{"byte", "int2"}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This converts a Java Class name to a org.postgresql table, by replacing . with
|
* This converts a Java Class name to a org.postgresql table, by replacing . with
|
||||||
* _<p>
|
* _<p>
|
||||||
*
|
*
|
||||||
@ -593,7 +593,7 @@ public class Serialize
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This converts a org.postgresql table to a Java Class name, by replacing _ with
|
* This converts a org.postgresql table to a Java Class name, by replacing _ with
|
||||||
* .<p>
|
* .<p>
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package org.postgresql.util;
|
package org.postgresql.util;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This class provides us with the ability to encrypt passwords when sent
|
* This class provides us with the ability to encrypt passwords when sent
|
||||||
* over the network stream
|
* over the network stream
|
||||||
*
|
*
|
||||||
@ -576,7 +576,7 @@ public class UnixCrypt extends Object
|
|||||||
return (out);
|
return (out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* <P>Encrypt a password given the cleartext password and a "salt".</P>
|
* <P>Encrypt a password given the cleartext password and a "salt".</P>
|
||||||
* @param salt A two-character string representing the salt used to
|
* @param salt A two-character string representing the salt used to
|
||||||
* iterate the encryption engine in lots of different ways. If you
|
* iterate the encryption engine in lots of different ways. If you
|
||||||
@ -645,7 +645,7 @@ public class UnixCrypt extends Object
|
|||||||
return (buffer.toString());
|
return (buffer.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* <P>Encrypt a password given the cleartext password. This method
|
* <P>Encrypt a password given the cleartext password. This method
|
||||||
* generates a random salt using the 'java.util.Random' class.</P>
|
* generates a random salt using the 'java.util.Random' class.</P>
|
||||||
* @param original The password to be encrypted.
|
* @param original The password to be encrypted.
|
||||||
@ -663,7 +663,7 @@ public class UnixCrypt extends Object
|
|||||||
return crypt(salt, original);
|
return crypt(salt, original);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* <P>Check that <I>enteredPassword</I> encrypts to
|
* <P>Check that <I>enteredPassword</I> encrypts to
|
||||||
* <I>encryptedPassword</I>.</P>
|
* <I>encryptedPassword</I>.</P>
|
||||||
* @param encryptedPassword The <I>encryptedPassword</I>. The first
|
* @param encryptedPassword The <I>encryptedPassword</I>. The first
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
* Redistribution and use of this software and associated documentation
|
* Redistribution and use of this software and associated documentation
|
||||||
* ("Software"), with or without modification, are permitted provided
|
* ("Software"), with or without modification, are permitted provided
|
||||||
* that the following conditions are met:
|
* that the following conditions are met:
|
||||||
@ -40,7 +40,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* $Id: ClientConnection.java,v 1.2 2001/10/25 06:00:05 momjian Exp $
|
* $Id: ClientConnection.java,v 1.3 2001/11/19 22:33:39 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ import java.util.*;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Encapsulates an application's view of an XA/pooled connection.
|
* Encapsulates an application's view of an XA/pooled connection.
|
||||||
* The XA connection is managed by the application server through it's
|
* The XA connection is managed by the application server through it's
|
||||||
* {@link javax.sql.XAConnection} interface. The underlying JDBC
|
* {@link javax.sql.XAConnection} interface. The underlying JDBC
|
||||||
@ -72,14 +72,14 @@ final class ClientConnection
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The pooled XA connection that created this client connection
|
* The pooled XA connection that created this client connection
|
||||||
* and should be used to report closure and fatal errors.
|
* and should be used to report closure and fatal errors.
|
||||||
*/
|
*/
|
||||||
private XAConnectionImpl _xaConn;
|
private XAConnectionImpl _xaConn;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This identifier was handed on to use when we were created by
|
* This identifier was handed on to use when we were created by
|
||||||
* {@link XAConnection}. If since then the XA connection was asked
|
* {@link XAConnection}. If since then the XA connection was asked
|
||||||
* to create another connection or was closed, our identifier will
|
* to create another connection or was closed, our identifier will
|
||||||
@ -94,7 +94,7 @@ final class ClientConnection
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Construct a new client connection to provide access to the
|
* Construct a new client connection to provide access to the
|
||||||
* underlying JDBC connection (<tt>underlying</tt>) on behalf of
|
* underlying JDBC connection (<tt>underlying</tt>) on behalf of
|
||||||
* an XA/pooled connection (<tt>xaConn<tt/>). The pooled connection
|
* an XA/pooled connection (<tt>xaConn<tt/>). The pooled connection
|
||||||
@ -483,7 +483,7 @@ final class ClientConnection
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Called by {@link XAConnectionImpl} to terminate this connection
|
* Called by {@link XAConnectionImpl} to terminate this connection
|
||||||
* by dissociating it from the underlying JDBC connection.
|
* by dissociating it from the underlying JDBC connection.
|
||||||
* The application would call {@link #close} but {@link
|
* The application would call {@link #close} but {@link
|
||||||
@ -520,7 +520,7 @@ final class ClientConnection
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Called when an exception is thrown by the underlying connection
|
* Called when an exception is thrown by the underlying connection
|
||||||
* to determine whether the exception is critical or not. If the
|
* to determine whether the exception is critical or not. If the
|
||||||
* exception is critical, notifies the XA connection to forget
|
* exception is critical, notifies the XA connection to forget
|
||||||
@ -536,7 +536,7 @@ final class ClientConnection
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Called to retrieve the underlying JDBC connection. Actual JDBC
|
* Called to retrieve the underlying JDBC connection. Actual JDBC
|
||||||
* operations are performed against it. Throws an SQLException if
|
* operations are performed against it. Throws an SQLException if
|
||||||
* this connection has been closed.
|
* this connection has been closed.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
* Redistribution and use of this software and associated documentation
|
* Redistribution and use of this software and associated documentation
|
||||||
* ("Software"), with or without modification, are permitted provided
|
* ("Software"), with or without modification, are permitted provided
|
||||||
* that the following conditions are met:
|
* that the following conditions are met:
|
||||||
@ -40,7 +40,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* $Id: TwoPhaseConnection.java,v 1.2 2001/10/25 06:00:05 momjian Exp $
|
* $Id: TwoPhaseConnection.java,v 1.3 2001/11/19 22:33:39 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ package org.postgresql.xa;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Defines two-phase commit support for a JDBC connection used by
|
* Defines two-phase commit support for a JDBC connection used by
|
||||||
* {@link XAConnection}. A JDBC connection that can implement any of
|
* {@link XAConnection}. A JDBC connection that can implement any of
|
||||||
* these features should extend this interface and attempt to
|
* these features should extend this interface and attempt to
|
||||||
@ -79,7 +79,7 @@ public interface TwoPhaseConnection
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Enables or disables transaction demarcation through SQL commit
|
* Enables or disables transaction demarcation through SQL commit
|
||||||
* and rollback. When the connection falls under control of
|
* and rollback. When the connection falls under control of
|
||||||
* {@link XAConnection}, SQL commit/rollback commands will be
|
* {@link XAConnection}, SQL commit/rollback commands will be
|
||||||
@ -90,7 +90,7 @@ public interface TwoPhaseConnection
|
|||||||
public void enableSQLTransactions( boolean flag );
|
public void enableSQLTransactions( boolean flag );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Called to prepare the transaction for commit. Returns true if
|
* Called to prepare the transaction for commit. Returns true if
|
||||||
* the transaction is prepared, false if the transaction is
|
* the transaction is prepared, false if the transaction is
|
||||||
* read-only. If the transaction has been marked for rollback,
|
* read-only. If the transaction has been marked for rollback,
|
||||||
@ -104,7 +104,7 @@ public interface TwoPhaseConnection
|
|||||||
throws SQLException;
|
throws SQLException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns true if the error issued by this connection is a
|
* Returns true if the error issued by this connection is a
|
||||||
* critical error and the connection should be terminated.
|
* critical error and the connection should be terminated.
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
* Redistribution and use of this software and associated documentation
|
* Redistribution and use of this software and associated documentation
|
||||||
* ("Software"), with or without modification, are permitted provided
|
* ("Software"), with or without modification, are permitted provided
|
||||||
* that the following conditions are met:
|
* that the following conditions are met:
|
||||||
@ -40,7 +40,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* $Id: TxConnection.java,v 1.2 2001/10/25 06:00:05 momjian Exp $
|
* $Id: TxConnection.java,v 1.3 2001/11/19 22:33:39 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ import java.sql.Connection;
|
|||||||
import javax.transaction.xa.Xid;
|
import javax.transaction.xa.Xid;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Describes an open connection associated with a transaction. When a
|
* Describes an open connection associated with a transaction. When a
|
||||||
* transaction is opened for a connection, this record is created for
|
* transaction is opened for a connection, this record is created for
|
||||||
* the connection. It indicates the underlying JDBC connection and
|
* the connection. It indicates the underlying JDBC connection and
|
||||||
@ -68,14 +68,14 @@ final class TxConnection
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The Xid of the transactions. Connections that are not
|
* The Xid of the transactions. Connections that are not
|
||||||
* associated with a transaction are not represented here.
|
* associated with a transaction are not represented here.
|
||||||
*/
|
*/
|
||||||
Xid xid;
|
Xid xid;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Holds the underlying JDBC connection for as long as this
|
* Holds the underlying JDBC connection for as long as this
|
||||||
* connection is useable. If the connection has been rolled back,
|
* connection is useable. If the connection has been rolled back,
|
||||||
* timed out or had any other error, this variable will null
|
* timed out or had any other error, this variable will null
|
||||||
@ -85,7 +85,7 @@ final class TxConnection
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Indicates the clock time (in ms) when the transaction should
|
* Indicates the clock time (in ms) when the transaction should
|
||||||
* time out. The transaction times out when
|
* time out. The transaction times out when
|
||||||
* <tt>System.currentTimeMillis() > timeout</tt>.
|
* <tt>System.currentTimeMillis() > timeout</tt>.
|
||||||
@ -93,32 +93,32 @@ final class TxConnection
|
|||||||
long timeout;
|
long timeout;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Indicates the clock time (in ms) when the transaction started.
|
* Indicates the clock time (in ms) when the transaction started.
|
||||||
*/
|
*/
|
||||||
long started;
|
long started;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Reference counter indicates how many XA connections share this
|
* Reference counter indicates how many XA connections share this
|
||||||
* underlying connection and transaction. Always one or more.
|
* underlying connection and transaction. Always one or more.
|
||||||
*/
|
*/
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* True if the transaction has failed due to time out.
|
* True if the transaction has failed due to time out.
|
||||||
*/
|
*/
|
||||||
boolean timedOut;
|
boolean timedOut;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* True if the transaction has already been prepared.
|
* True if the transaction has already been prepared.
|
||||||
*/
|
*/
|
||||||
boolean prepared;
|
boolean prepared;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* True if the transaction has been prepared and found out to be
|
* True if the transaction has been prepared and found out to be
|
||||||
* read-only. Read-only transactions do not require commit/rollback.
|
* read-only. Read-only transactions do not require commit/rollback.
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
* Redistribution and use of this software and associated documentation
|
* Redistribution and use of this software and associated documentation
|
||||||
* ("Software"), with or without modification, are permitted provided
|
* ("Software"), with or without modification, are permitted provided
|
||||||
* that the following conditions are met:
|
* that the following conditions are met:
|
||||||
@ -40,7 +40,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* $Id: XAConnectionImpl.java,v 1.2 2001/10/25 06:00:05 momjian Exp $
|
* $Id: XAConnectionImpl.java,v 1.3 2001/11/19 22:33:39 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ import javax.transaction.xa.Xid;
|
|||||||
import javax.transaction.xa.XAException;
|
import javax.transaction.xa.XAException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Implements an X/A connection that can be pooled and managed from
|
* Implements an X/A connection that can be pooled and managed from
|
||||||
* inside a transaction monitor. This is the XA connection returned
|
* inside a transaction monitor. This is the XA connection returned
|
||||||
* to the application server from the {@link XADataSourceImpl} and
|
* to the application server from the {@link XADataSourceImpl} and
|
||||||
@ -87,7 +87,7 @@ public final class XAConnectionImpl
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This is the underlying JDBC connection represented
|
* This is the underlying JDBC connection represented
|
||||||
* by this pooled connection. This variable may initially be null,
|
* by this pooled connection. This variable may initially be null,
|
||||||
* in which case {@link #getUnderlying} will return a new
|
* in which case {@link #getUnderlying} will return a new
|
||||||
@ -98,7 +98,7 @@ public final class XAConnectionImpl
|
|||||||
Connection _underlying;
|
Connection _underlying;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* If this connection is part of a global transaction, this
|
* If this connection is part of a global transaction, this
|
||||||
* object identifies the transaction. The transaction's
|
* object identifies the transaction. The transaction's
|
||||||
* underlying JDBC connection is exposed through this object and
|
* underlying JDBC connection is exposed through this object and
|
||||||
@ -109,7 +109,7 @@ public final class XAConnectionImpl
|
|||||||
private TxConnection _txConn;
|
private TxConnection _txConn;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The client connection last handed to the application. If the
|
* The client connection last handed to the application. If the
|
||||||
* application calls {@link #getConnection} again, we should hand
|
* application calls {@link #getConnection} again, we should hand
|
||||||
* out a new client connection and render the previous one closed.
|
* out a new client connection and render the previous one closed.
|
||||||
@ -118,7 +118,7 @@ public final class XAConnectionImpl
|
|||||||
//private ClientConnection _clientConn;
|
//private ClientConnection _clientConn;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* An event listener can be registered and notified when the
|
* An event listener can be registered and notified when the
|
||||||
* client connection has been closed by the application or a
|
* client connection has been closed by the application or a
|
||||||
* fatal error rendered it unuseable.
|
* fatal error rendered it unuseable.
|
||||||
@ -126,14 +126,14 @@ public final class XAConnectionImpl
|
|||||||
private ConnectionEventListener _listener;
|
private ConnectionEventListener _listener;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The resource manager is used to share connections within the
|
* The resource manager is used to share connections within the
|
||||||
* same transaction.
|
* same transaction.
|
||||||
*/
|
*/
|
||||||
private XADataSourceImpl _resManager;
|
private XADataSourceImpl _resManager;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This is an identifier we hand to the client connection when we
|
* This is an identifier we hand to the client connection when we
|
||||||
* create it. When the client connection asks for the underlying
|
* create it. When the client connection asks for the underlying
|
||||||
* connection, we compare the identifiers. If since that point we
|
* connection, we compare the identifiers. If since that point we
|
||||||
@ -149,7 +149,7 @@ public final class XAConnectionImpl
|
|||||||
private int _clientId = 1;
|
private int _clientId = 1;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Construct a new XA/pooled connection with the underlying JDBC
|
* Construct a new XA/pooled connection with the underlying JDBC
|
||||||
* connection suitable for this driver only. This is a one to one
|
* connection suitable for this driver only. This is a one to one
|
||||||
* mapping between this connection and the underlying connection.
|
* mapping between this connection and the underlying connection.
|
||||||
@ -288,7 +288,7 @@ public final class XAConnectionImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Called by {@link ClientConnection} to notify that the application
|
* Called by {@link ClientConnection} to notify that the application
|
||||||
* has attempted to close the connection. After this call, the client
|
* has attempted to close the connection. After this call, the client
|
||||||
* connection is no longer useable and this pooled connection can be
|
* connection is no longer useable and this pooled connection can be
|
||||||
@ -341,7 +341,7 @@ public final class XAConnectionImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Called by {@link ClientConnection} to notify that an error
|
* Called by {@link ClientConnection} to notify that an error
|
||||||
* occured with the underlying connection. If the error is
|
* occured with the underlying connection. If the error is
|
||||||
* critical, the underlying connection is closed and the listener
|
* critical, the underlying connection is closed and the listener
|
||||||
@ -903,7 +903,7 @@ public final class XAConnectionImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns true if this connection is inside a global transaction.
|
* Returns true if this connection is inside a global transaction.
|
||||||
* If the connection is inside a global transaction it will not
|
* If the connection is inside a global transaction it will not
|
||||||
* allow commit/rollback directly from the {@link
|
* allow commit/rollback directly from the {@link
|
||||||
@ -914,8 +914,7 @@ public final class XAConnectionImpl
|
|||||||
return ( _txConn != null );
|
return ( _txConn != null );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
/**
|
|
||||||
* Called to obtain the underlying connections. If this connection
|
* Called to obtain the underlying connections. If this connection
|
||||||
* is part of a transaction, the transction's underlying connection
|
* is part of a transaction, the transction's underlying connection
|
||||||
* is returned, or an exception is thrown if the connection was
|
* is returned, or an exception is thrown if the connection was
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
* Redistribution and use of this software and associated documentation
|
* Redistribution and use of this software and associated documentation
|
||||||
* ("Software"), with or without modification, are permitted provided
|
* ("Software"), with or without modification, are permitted provided
|
||||||
* that the following conditions are met:
|
* that the following conditions are met:
|
||||||
@ -40,7 +40,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* $Id: XADataSourceImpl.java,v 1.2 2001/10/25 06:00:05 momjian Exp $
|
* $Id: XADataSourceImpl.java,v 1.3 2001/11/19 22:33:39 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ import javax.transaction.xa.Xid;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Implements a JDBC 2.0 {@link XADataSource} for any JDBC driver
|
* Implements a JDBC 2.0 {@link XADataSource} for any JDBC driver
|
||||||
* with JNDI persistance support. The base implementation is actually
|
* with JNDI persistance support. The base implementation is actually
|
||||||
* provided by a different {@link DataSource} class; although this is
|
* provided by a different {@link DataSource} class; although this is
|
||||||
@ -82,13 +82,13 @@ public abstract class XADataSourceImpl
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Maps underlying JDBC connections into global transaction Xids.
|
* Maps underlying JDBC connections into global transaction Xids.
|
||||||
*/
|
*/
|
||||||
private transient Hashtable _txConnections = new Hashtable();
|
private transient Hashtable _txConnections = new Hashtable();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This is a pool of free underlying JDBC connections. If two
|
* This is a pool of free underlying JDBC connections. If two
|
||||||
* XA connections are used in the same transaction, the second
|
* XA connections are used in the same transaction, the second
|
||||||
* one will make its underlying JDBC connection available to
|
* one will make its underlying JDBC connection available to
|
||||||
@ -98,20 +98,20 @@ public abstract class XADataSourceImpl
|
|||||||
private transient Stack _pool = new Stack();
|
private transient Stack _pool = new Stack();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* A background deamon thread terminating connections that have
|
* A background deamon thread terminating connections that have
|
||||||
* timed out.
|
* timed out.
|
||||||
*/
|
*/
|
||||||
private transient Thread _background;
|
private transient Thread _background;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The default timeout for all new transactions.
|
* The default timeout for all new transactions.
|
||||||
*/
|
*/
|
||||||
private int _txTimeout = DEFAULT_TX_TIMEOUT;
|
private int _txTimeout = DEFAULT_TX_TIMEOUT;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The default timeout for all new transactions is 10 seconds.
|
* The default timeout for all new transactions is 10 seconds.
|
||||||
*/
|
*/
|
||||||
public final static int DEFAULT_TX_TIMEOUT = 10;
|
public final static int DEFAULT_TX_TIMEOUT = 10;
|
||||||
@ -119,7 +119,7 @@ public abstract class XADataSourceImpl
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Implementation details:
|
* Implementation details:
|
||||||
* If two XAConnections are associated with the same transaction
|
* If two XAConnections are associated with the same transaction
|
||||||
* (one with a start the other with a join) they must use the
|
* (one with a start the other with a join) they must use the
|
||||||
@ -192,7 +192,7 @@ public abstract class XADataSourceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the default timeout for all transactions.
|
* Returns the default timeout for all transactions.
|
||||||
*/
|
*/
|
||||||
public int getTransactionTimeout()
|
public int getTransactionTimeout()
|
||||||
@ -201,7 +201,7 @@ public abstract class XADataSourceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* This method is defined in the interface and implemented in the
|
* This method is defined in the interface and implemented in the
|
||||||
* derived class, we re-define it just to make sure it does not
|
* derived class, we re-define it just to make sure it does not
|
||||||
* throw an {@link SQLException} and that we do not need to
|
* throw an {@link SQLException} and that we do not need to
|
||||||
@ -210,7 +210,7 @@ public abstract class XADataSourceImpl
|
|||||||
public abstract java.io.PrintWriter getLogWriter();
|
public abstract java.io.PrintWriter getLogWriter();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Sets the default timeout for all transactions. The timeout is
|
* Sets the default timeout for all transactions. The timeout is
|
||||||
* specified in seconds. Use zero for the default timeout. Calling
|
* specified in seconds. Use zero for the default timeout. Calling
|
||||||
* this method does not affect transactions in progress.
|
* this method does not affect transactions in progress.
|
||||||
@ -227,7 +227,7 @@ public abstract class XADataSourceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns an underlying connection for the global transaction,
|
* Returns an underlying connection for the global transaction,
|
||||||
* if one has been associated before.
|
* if one has been associated before.
|
||||||
*
|
*
|
||||||
@ -240,7 +240,7 @@ public abstract class XADataSourceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Associates the global transaction with an underlying connection,
|
* Associates the global transaction with an underlying connection,
|
||||||
* or dissociate it when null is passed.
|
* or dissociate it when null is passed.
|
||||||
*
|
*
|
||||||
@ -256,7 +256,7 @@ public abstract class XADataSourceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Release an unused connection back to the pool. If an XA
|
* Release an unused connection back to the pool. If an XA
|
||||||
* connection has been asked to join an existing transaction,
|
* connection has been asked to join an existing transaction,
|
||||||
* it will no longer use it's own connection and make it available
|
* it will no longer use it's own connection and make it available
|
||||||
@ -270,7 +270,7 @@ public abstract class XADataSourceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Creates a new underlying connection. Used by XA connection
|
* Creates a new underlying connection. Used by XA connection
|
||||||
* that lost it's underlying connection when joining a
|
* that lost it's underlying connection when joining a
|
||||||
* transaction and is now asked to produce a new connection.
|
* transaction and is now asked to produce a new connection.
|
||||||
@ -294,7 +294,7 @@ public abstract class XADataSourceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* XXX Not fully implemented yet and no code to really
|
* XXX Not fully implemented yet and no code to really
|
||||||
* test it.
|
* test it.
|
||||||
*/
|
*/
|
||||||
@ -316,7 +316,7 @@ public abstract class XADataSourceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the transaction isolation level to use with all newly
|
* Returns the transaction isolation level to use with all newly
|
||||||
* created transactions, or {@link Connection#TRANSACTION_NONE}
|
* created transactions, or {@link Connection#TRANSACTION_NONE}
|
||||||
* if using the driver's default isolation level.
|
* if using the driver's default isolation level.
|
||||||
|
Reference in New Issue
Block a user