diff --git a/src/interfaces/jdbc/example/Unicode.java b/src/interfaces/jdbc/example/Unicode.java index 7303ee7bc2046844cd1daa52d12005c846d03ba8..f10e4544305e2b52137f7985fdb22da9f7497907 100644 --- a/src/interfaces/jdbc/example/Unicode.java +++ b/src/interfaces/jdbc/example/Unicode.java @@ -233,7 +233,7 @@ public class Unicode catch (ClassNotFoundException cnfe) { log("Unable to load driver", cnfe); - return; + return ; } try { diff --git a/src/interfaces/jdbc/example/basic.java b/src/interfaces/jdbc/example/basic.java index 5f07a56c3f52a423e6905765624f4faa61aaf26c..61ef493181dba2ac9c0f15a3c36353d4b23474bf 100644 --- a/src/interfaces/jdbc/example/basic.java +++ b/src/interfaces/jdbc/example/basic.java @@ -6,7 +6,7 @@ import java.text.*; /* * - * $Id: basic.java,v 1.12 2002/07/23 03:59:54 barry Exp $ + * $Id: basic.java,v 1.13 2002/09/06 21:23:05 momjian Exp $ * * This example tests the basic components of the JDBC driver, and shows * how even the simplest of queries can be implemented. @@ -137,6 +137,7 @@ public class basic // result if you don't know what column number a value is in + System.out.println("performing another query"); rs = st.executeQuery("select * from basic where b>1"); if (rs != null) @@ -164,6 +165,7 @@ public class basic // Now test maxrows by setting it to 3 rows + st.setMaxRows(3); System.out.println("performing a query limited to " + st.getMaxRows()); rs = st.executeQuery("select a, b from basic"); diff --git a/src/interfaces/jdbc/example/corba/StockClient.java b/src/interfaces/jdbc/example/corba/StockClient.java index 258d2df2f4e95c4c2172eefb594a5c02d91d4ccf..127e157c33cd92d305b7e50f16668a4e40f13d41 100644 --- a/src/interfaces/jdbc/example/corba/StockClient.java +++ b/src/interfaces/jdbc/example/corba/StockClient.java @@ -9,7 +9,7 @@ import org.omg.CosNaming.*; * * It has no GUI, just a text frontend to keep it simple. * - * $Id: StockClient.java,v 1.5 2001/11/19 23:19:20 momjian Exp $ + * $Id: StockClient.java,v 1.6 2002/09/06 21:23:05 momjian Exp $ */ public class StockClient { @@ -35,14 +35,14 @@ public class StockClient if (nameServiceObj == null) { System.err.println("nameServiceObj == null"); - return; + return ; } nameService = org.omg.CosNaming.NamingContextHelper.narrow(nameServiceObj); if (nameService == null) { System.err.println("nameService == null"); - return; + return ; } // Resolve the dispenser @@ -53,7 +53,7 @@ public class StockClient if (dispenser == null) { System.err.println("dispenser == null"); - return; + return ; } // Now run the front end. diff --git a/src/interfaces/jdbc/example/corba/StockDispenserImpl.java b/src/interfaces/jdbc/example/corba/StockDispenserImpl.java index 15adfe559bca71aba32f12dbe3f38f13ca9602b4..7dc7f5c20329d51b34e6f44d33e23976da856c98 100644 --- a/src/interfaces/jdbc/example/corba/StockDispenserImpl.java +++ b/src/interfaces/jdbc/example/corba/StockDispenserImpl.java @@ -5,7 +5,7 @@ import org.omg.CosNaming.*; /* * This class implements the server side of the example. * - * $Id: StockDispenserImpl.java,v 1.4 2001/11/19 23:19:20 momjian Exp $ + * $Id: StockDispenserImpl.java,v 1.5 2002/09/06 21:23:05 momjian Exp $ */ public class StockDispenserImpl extends stock._StockDispenserImplBase { @@ -67,11 +67,11 @@ public class StockDispenserImpl extends stock._StockDispenserImplBase { stock[i].inUse = false; System.out.println("Releasing slot " + i); - return; + return ; } } System.out.println("Reserved object not a member of this dispenser"); - return; + return ; } /* diff --git a/src/interfaces/jdbc/example/corba/StockServer.java b/src/interfaces/jdbc/example/corba/StockServer.java index 43dcbc64facb307e98bcf9b0897484493c5e9428..76d3fffe08b2eb8a78a909136ba77bec83431d16 100644 --- a/src/interfaces/jdbc/example/corba/StockServer.java +++ b/src/interfaces/jdbc/example/corba/StockServer.java @@ -5,7 +5,7 @@ import org.omg.CosNaming.*; /* * This class implements the server side of the example. * - * $Id: StockServer.java,v 1.4 2001/11/19 23:19:20 momjian Exp $ + * $Id: StockServer.java,v 1.5 2002/09/06 21:23:05 momjian Exp $ */ public class StockServer { @@ -29,14 +29,14 @@ public class StockServer if (nameServiceObj == null) { System.err.println("nameServiceObj = null"); - return; + return ; } org.omg.CosNaming.NamingContext nameService = org.omg.CosNaming.NamingContextHelper.narrow(nameServiceObj); if (nameService == null) { System.err.println("nameService = null"); - return; + return ; } // bind the dispenser into the naming service diff --git a/src/interfaces/jdbc/example/psql.java b/src/interfaces/jdbc/example/psql.java index 0593293727963fe939ea8db6c22a5f29ed6988f5..a5af214d57438c2a094d0750595d4990b6a3baf3 100644 --- a/src/interfaces/jdbc/example/psql.java +++ b/src/interfaces/jdbc/example/psql.java @@ -82,7 +82,7 @@ public class psql if (line.startsWith("\\")) { processSlashCommand(line); - return; + return ; } boolean type = st.execute(line); diff --git a/src/interfaces/jdbc/org/postgresql/Driver.java.in b/src/interfaces/jdbc/org/postgresql/Driver.java.in index 7d2ad9f1007769e915153387867a82143e4ee488..019a78dbebcbefcdd2c9daf821bb351dfbe9daff 100644 --- a/src/interfaces/jdbc/org/postgresql/Driver.java.in +++ b/src/interfaces/jdbc/org/postgresql/Driver.java.in @@ -31,8 +31,8 @@ public class Driver implements java.sql.Driver public static final int DEBUG = 2; public static final int INFO = 1; - public static boolean logDebug = false; - public static boolean logInfo = false; + public static boolean logDebug = false; + public static boolean logInfo = false; static { @@ -70,11 +70,11 @@ public class Driver implements java.sql.Driver * to/from the database to unicode. If multibyte is enabled on the * server then the character set of the database is used as the default, * otherwise the jvm character encoding is used as the default. - * loglevel - (optional) Enable logging of messages from the driver. - * The value is an integer from 1 to 2 where: - * INFO = 1, DEBUG = 2 - * The output is sent to DriverManager.getPrintWriter() if set, - * otherwise it is sent to System.out. + * loglevel - (optional) Enable logging of messages from the driver. + * The value is an integer from 1 to 2 where: + * INFO = 1, DEBUG = 2 + * The output is sent to DriverManager.getPrintWriter() if set, + * otherwise it is sent to System.out. * compatible - (optional) This is used to toggle * between different functionality as it changes across different releases * of the jdbc driver code. The values here are versions of the jdbc @@ -109,12 +109,14 @@ public class Driver implements java.sql.Driver { if ((props = parseURL(url, info)) == null) { - if (Driver.logDebug) Driver.debug("Error in url" + url); + if (Driver.logDebug) + Driver.debug("Error in url" + url); return null; } try { - if (Driver.logDebug) Driver.debug("connect " + url); + if (Driver.logDebug) + Driver.debug("connect " + url); @JDBCCONNECTCLASS@ con = (@JDBCCONNECTCLASS@)(Class.forName("@JDBCCONNECTCLASS@").newInstance()); con.openConnection (host(), port(), props, database(), url, this); @@ -122,7 +124,8 @@ public class Driver implements java.sql.Driver } catch (ClassNotFoundException ex) { - if (Driver.logDebug) Driver.debug("error", ex); + if (Driver.logDebug) + Driver.debug("error", ex); throw new PSQLException("postgresql.jvm.version", ex); } catch (PSQLException ex1) @@ -133,7 +136,8 @@ public class Driver implements java.sql.Driver } catch (Exception ex2) { - if (Driver.logDebug) Driver.debug("error", ex2); + if (Driver.logDebug) + Driver.debug("error", ex2); throw new PSQLException("postgresql.unusual", ex2); } } @@ -177,7 +181,7 @@ public class Driver implements java.sql.Driver */ public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException { - //This method isn't really implemented + //This method isn't really implemented Properties p = parseURL(url, info); return new DriverPropertyInfo[0]; } @@ -385,16 +389,16 @@ public class Driver implements java.sql.Driver } /** - * used to turn logging on to a certain level, can be called + * used to turn logging on to a certain level, can be called * by specifying fully qualified class ie org.postgresql.Driver.setLogLevel() * @param int logLevel sets the level which logging will respond to - * INFO being almost no messages + * INFO being almost no messages * DEBUG most verbose */ public static void setLogLevel(int logLevel) { - logDebug = (logLevel >= DEBUG) ? true : false; - logInfo = (logLevel >= INFO) ? true : false; + logDebug = (logLevel >= DEBUG) ? true : false; + logInfo = (logLevel >= INFO) ? true : false; } /* * logging message at the debug level @@ -441,7 +445,7 @@ public class Driver implements java.sql.Driver } } - //The build number should be incremented for every new build - private static int m_buildNumber = 104; + //The build number should be incremented for every new build + private static int m_buildNumber = 104; } diff --git a/src/interfaces/jdbc/org/postgresql/PGConnection.java b/src/interfaces/jdbc/org/postgresql/PGConnection.java index 2d22a318b0a4dd4e767f1ec329ab91844cf7aa42..a45fddcb1cfad9404ca6d40efe03a2ccdb37c6ac 100644 --- a/src/interfaces/jdbc/org/postgresql/PGConnection.java +++ b/src/interfaces/jdbc/org/postgresql/PGConnection.java @@ -7,74 +7,74 @@ import org.postgresql.core.Encoding; import org.postgresql.fastpath.Fastpath; import org.postgresql.largeobject.LargeObjectManager; -/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGConnection.java,v 1.2 2002/09/02 03:07:36 barry Exp $ +/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGConnection.java,v 1.3 2002/09/06 21:23:05 momjian Exp $ * This interface defines PostgreSQL extentions to the java.sql.Connection interface. - * Any java.sql.Connection object returned by the driver will also implement this + * Any java.sql.Connection object returned by the driver will also implement this * interface */ public interface PGConnection { - /* - * Get the character encoding to use for this connection. - */ - public Encoding getEncoding() throws SQLException; + /* + * Get the character encoding to use for this connection. + */ + public Encoding getEncoding() throws SQLException; - /* - * This method returns the java.sql.Types type for a postgres datatype name - */ - public int getSQLType(String pgTypeName) throws SQLException; + /* + * This method returns the java.sql.Types type for a postgres datatype name + */ + public int getSQLType(String pgTypeName) throws SQLException; - /* - * This returns the java.sql.Types type for a postgres datatype OID - */ - public int getSQLType(int oid) throws SQLException; + /* + * This returns the java.sql.Types type for a postgres datatype OID + */ + public int getSQLType(int oid) throws SQLException; - /* - * This returns the postgres datatype name from the - * postgres datatype OID - */ - public String getPGType(int oid) throws SQLException; + /* + * This returns the postgres datatype name from the + * postgres datatype OID + */ + public String getPGType(int oid) throws SQLException; - /* - * This returns the postgres datatype OID from the - * postgres datatype name - */ - public int getPGType(String typeName) throws SQLException; + /* + * This returns the postgres datatype OID from the + * postgres datatype name + */ + public int getPGType(String typeName) throws SQLException; - /* - * This returns the LargeObject API for the current connection. - */ - public LargeObjectManager getLargeObjectAPI() throws SQLException; + /* + * This returns the LargeObject API for the current connection. + */ + public LargeObjectManager getLargeObjectAPI() throws SQLException; - /* - * This returns the Fastpath API for the current connection. - */ - public Fastpath getFastpathAPI() throws SQLException; + /* + * This returns the Fastpath API for the current connection. + */ + public Fastpath getFastpathAPI() throws SQLException; - /* - * This method is used internally to return an object based around - * org.postgresql's more unique data types. - * - *
It uses an internal Hashtable to get the handling class. If the - * type is not supported, then an instance of org.postgresql.util.PGobject - * is returned. - * - * You can use the getValue() or setValue() methods to handle the returned - * object. Custom objects can have their own methods. - * - * @return PGobject for this type, and set to value - * @exception SQLException if value is not correct for this type - * @see org.postgresql.util.Serialize - */ - public Object getObject(String type, String value) throws SQLException; + /* + * This method is used internally to return an object based around + * org.postgresql's more unique data types. + * + *
It uses an internal Hashtable to get the handling class. If the + * type is not supported, then an instance of org.postgresql.util.PGobject + * is returned. + * + * You can use the getValue() or setValue() methods to handle the returned + * object. Custom objects can have their own methods. + * + * @return PGobject for this type, and set to value + * @exception SQLException if value is not correct for this type + * @see org.postgresql.util.Serialize + */ + public Object getObject(String type, String value) throws SQLException; - /* - * This method returns any notifications that have been received - * since the last call to this method. - * Returns null if there have been no notifications. - */ - public PGNotification[] getNotifications(); + /* + * This method returns any notifications that have been received + * since the last call to this method. + * Returns null if there have been no notifications. + */ + public PGNotification[] getNotifications(); } diff --git a/src/interfaces/jdbc/org/postgresql/PGNotification.java b/src/interfaces/jdbc/org/postgresql/PGNotification.java index 0413e9b35097723705efc43472b0549a40f0dc7d..dbcd6fbe6a054a258dbc76caaa60b100c44bed9d 100644 --- a/src/interfaces/jdbc/org/postgresql/PGNotification.java +++ b/src/interfaces/jdbc/org/postgresql/PGNotification.java @@ -1,20 +1,20 @@ package org.postgresql; -/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGNotification.java,v 1.1 2002/09/02 03:07:36 barry Exp $ +/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGNotification.java,v 1.2 2002/09/06 21:23:05 momjian Exp $ * This interface defines PostgreSQL extention for Notifications */ public interface PGNotification { - /* - * Returns name of this notification - */ - public String getName(); + /* + * Returns name of this notification + */ + public String getName(); - /* - * Returns the process id of the backend process making this notification - */ - public int getPID(); + /* + * Returns the process id of the backend process making this notification + */ + public int getPID(); } diff --git a/src/interfaces/jdbc/org/postgresql/PGStatement.java b/src/interfaces/jdbc/org/postgresql/PGStatement.java index a226246a81d197d141275a71d1d222ad6f8aa894..13aff7cde4c8ec93df25538a378dd7513158c5a5 100644 --- a/src/interfaces/jdbc/org/postgresql/PGStatement.java +++ b/src/interfaces/jdbc/org/postgresql/PGStatement.java @@ -3,23 +3,23 @@ package org.postgresql; import java.sql.*; -/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGStatement.java,v 1.4 2002/09/02 03:07:36 barry Exp $ +/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGStatement.java,v 1.5 2002/09/06 21:23:05 momjian Exp $ * This interface defines PostgreSQL extentions to the java.sql.Statement interface. - * Any java.sql.Statement object returned by the driver will also implement this + * Any java.sql.Statement object returned by the driver will also implement this * interface */ public interface PGStatement { /* - * Returns the Last inserted/updated oid. + * Returns the Last inserted/updated oid. * @return OID of last insert - * @since 7.3 + * @since 7.3 */ - public long getLastOID() throws SQLException; + public long getLastOID() throws SQLException; - public void setUseServerPrepare(boolean flag); + public void setUseServerPrepare(boolean flag); - public boolean isUseServerPrepare(); + public boolean isUseServerPrepare(); } diff --git a/src/interfaces/jdbc/org/postgresql/core/Encoding.java b/src/interfaces/jdbc/org/postgresql/core/Encoding.java index 2c4b0d348060c9ed723bc90831878464556a897e..95d4af5781febc91e2f6e6239db1348a5eac96e9 100644 --- a/src/interfaces/jdbc/org/postgresql/core/Encoding.java +++ b/src/interfaces/jdbc/org/postgresql/core/Encoding.java @@ -8,7 +8,7 @@ import org.postgresql.util.*; /* * Converts to and from the character encoding used by the backend. * - * $Id: Encoding.java,v 1.5 2002/03/19 02:48:45 momjian Exp $ + * $Id: Encoding.java,v 1.6 2002/09/06 21:23:05 momjian Exp $ */ public class Encoding @@ -42,14 +42,14 @@ public class Encoding encodings.put("EUC_KR", new String[] { "EUC_KR" }); encodings.put("JOHAB", new String[] { "Johab" }); encodings.put("EUC_TW", new String[] { "EUC_TW" }); - encodings.put("SJIS", new String[] { "MS932","SJIS" }); - encodings.put("BIG5", new String[] { "Big5","MS950","Cp950" }); - encodings.put("GBK", new String[] { "GBK","MS936" }); - encodings.put("UHC", new String[] { "MS949","Cp949","Cp949C" }); + encodings.put("SJIS", new String[] { "MS932", "SJIS" }); + encodings.put("BIG5", new String[] { "Big5", "MS950", "Cp950" }); + encodings.put("GBK", new String[] { "GBK", "MS936" }); + encodings.put("UHC", new String[] { "MS949", "Cp949", "Cp949C" }); encodings.put("TCVN", new String[] { "Cp1258" }); encodings.put("WIN1256", new String[] { "Cp1256" }); encodings.put("WIN1250", new String[] { "Cp1250" }); - encodings.put("WIN874", new String[] { "MS874","Cp874" }); + encodings.put("WIN874", new String[] { "MS874", "Cp874" }); encodings.put("WIN", new String[] { "Cp1251" }); encodings.put("ALT", new String[] { "Cp866" }); // We prefer KOI8-U, since it is a superset of KOI8-R. diff --git a/src/interfaces/jdbc/org/postgresql/core/Notification.java b/src/interfaces/jdbc/org/postgresql/core/Notification.java index 9612df4f74fac9dd281613f6a5d348a6e81ddff8..464e167b8c84d2d9290b5a4e3fe31f7bd3851376 100644 --- a/src/interfaces/jdbc/org/postgresql/core/Notification.java +++ b/src/interfaces/jdbc/org/postgresql/core/Notification.java @@ -1,32 +1,35 @@ package org.postgresql.core; -/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Notification.java,v 1.1 2002/09/02 03:07:36 barry Exp $ +/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Notification.java,v 1.2 2002/09/06 21:23:05 momjian Exp $ * This is the implementation of the PGNotification interface */ public class Notification implements org.postgresql.PGNotification { - public Notification(String p_name, int p_pid) { - m_name = p_name; - m_pid = p_pid; - } + public Notification(String p_name, int p_pid) + { + m_name = p_name; + m_pid = p_pid; + } - /* - * Returns name of this notification - */ - public String getName() { - return m_name; - } + /* + * Returns name of this notification + */ + public String getName() + { + return m_name; + } - /* - * Returns the process id of the backend process making this notification - */ - public int getPID() { - return m_pid; - } + /* + * Returns the process id of the backend process making this notification + */ + public int getPID() + { + return m_pid; + } - private String m_name; - private int m_pid; + private String m_name; + private int m_pid; } diff --git a/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java b/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java index 0a842c193cf2ec19a682061a2f47ce7deea2f920..a16bd73dde14f6f0d590859d6516be63b27a5026 100644 --- a/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java +++ b/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java @@ -13,208 +13,209 @@ import org.postgresql.util.PSQLException; *
The lifetime of a QueryExecutor object is from sending the query * until the response has been received from the backend. * - * $Id: QueryExecutor.java,v 1.15 2002/09/02 03:07:36 barry Exp $ + * $Id: QueryExecutor.java,v 1.16 2002/09/06 21:23:05 momjian Exp $ */ public class QueryExecutor { - private final String[] m_sqlFrags; - private final Object[] m_binds; - private final java.sql.Statement statement; - private final PG_Stream pg_stream; - private final org.postgresql.jdbc1.AbstractJdbc1Connection connection; - - public QueryExecutor(String[] p_sqlFrags, Object[] p_binds, - java.sql.Statement statement, - PG_Stream pg_stream, - java.sql.Connection connection) - throws SQLException - { - this.m_sqlFrags = p_sqlFrags; - this.m_binds = p_binds; - this.statement = statement; - this.pg_stream = pg_stream; - this.connection = (org.postgresql.jdbc1.AbstractJdbc1Connection)connection; - - if (statement != null) - maxRows = statement.getMaxRows(); - else - maxRows = 0; - } - - private Field[] fields = null; - private Vector tuples = new Vector(); - private boolean binaryCursor = false; - private String status = null; - private int update_count = 1; - private long insert_oid = 0; - private int maxRows; - - /* - * Execute a query on the backend. - */ - public java.sql.ResultSet execute() throws SQLException - { - - StringBuffer errorMessage = null; - - synchronized (pg_stream) - { - - sendQuery(); - - int c; - boolean l_endQuery = false; - while (!l_endQuery) - { - c = pg_stream.ReceiveChar(); - - switch (c) - { - case 'A': // Asynchronous Notify - int pid = pg_stream.ReceiveInteger(4); - String msg = pg_stream.ReceiveString(connection.getEncoding()); + private final String[] m_sqlFrags; + private final Object[] m_binds; + private final java.sql.Statement statement; + private final PG_Stream pg_stream; + private final org.postgresql.jdbc1.AbstractJdbc1Connection connection; + + public QueryExecutor(String[] p_sqlFrags, Object[] p_binds, + java.sql.Statement statement, + PG_Stream pg_stream, + java.sql.Connection connection) + throws SQLException + { + this.m_sqlFrags = p_sqlFrags; + this.m_binds = p_binds; + this.statement = statement; + this.pg_stream = pg_stream; + this.connection = (org.postgresql.jdbc1.AbstractJdbc1Connection)connection; + + if (statement != null) + maxRows = statement.getMaxRows(); + else + maxRows = 0; + } + + private Field[] fields = null; + private Vector tuples = new Vector(); + private boolean binaryCursor = false; + private String status = null; + private int update_count = 1; + private long insert_oid = 0; + private int maxRows; + + /* + * Execute a query on the backend. + */ + public java.sql.ResultSet execute() throws SQLException + { + + StringBuffer errorMessage = null; + + synchronized (pg_stream) + { + + sendQuery(); + + int c; + boolean l_endQuery = false; + while (!l_endQuery) + { + c = pg_stream.ReceiveChar(); + + switch (c) + { + case 'A': // Asynchronous Notify + int pid = pg_stream.ReceiveInteger(4); + String msg = pg_stream.ReceiveString(connection.getEncoding()); connection.addNotification(new org.postgresql.core.Notification(msg, pid)); - break; - case 'B': // Binary Data Transfer - receiveTuple(true); - break; - case 'C': // Command Status - receiveCommandStatus(); - break; - case 'D': // Text Data Transfer - receiveTuple(false); - break; - case 'E': // Error Message - - // it's possible to get more than one error message for a query - // see libpq comments wrt backend closing a connection - // so, append messages to a string buffer and keep processing - // check at the bottom to see if we need to throw an exception - - if ( errorMessage == null ) - errorMessage = new StringBuffer(); - - errorMessage.append(pg_stream.ReceiveString(connection.getEncoding())); - // keep processing - break; - case 'I': // Empty Query - int t = pg_stream.ReceiveChar(); - break; - case 'N': // Error Notification - connection.addWarning(pg_stream.ReceiveString(connection.getEncoding())); - break; - case 'P': // Portal Name - String pname = pg_stream.ReceiveString(connection.getEncoding()); - break; - case 'T': // MetaData Field Description - receiveFields(); - break; - case 'Z': - l_endQuery = true; - break; - default: - throw new PSQLException("postgresql.con.type", - new Character((char) c)); - } - - } - - // did we get an error during this query? - if ( errorMessage != null ) - throw new SQLException( errorMessage.toString() ); - - return connection.getResultSet(statement, fields, tuples, status, update_count, insert_oid, binaryCursor); - } - } - - /* - * Send a query to the backend. - */ - private void sendQuery() throws SQLException - { - try - { - pg_stream.SendChar('Q'); - for (int i = 0 ; i < m_binds.length ; ++i) { - if (m_binds[i] == null) - throw new PSQLException("postgresql.prep.param", new Integer(i + 1)); - pg_stream.Send(connection.getEncoding().encode(m_sqlFrags[i])); - pg_stream.Send(connection.getEncoding().encode(m_binds[i].toString())); - } - pg_stream.Send(connection.getEncoding().encode(m_sqlFrags[m_binds.length])); - pg_stream.SendChar(0); - pg_stream.flush(); - - } - catch (IOException e) - { - throw new PSQLException("postgresql.con.ioerror", e); - } - } - - /* - * Receive a tuple from the backend. - * - * @param isBinary set if the tuple should be treated as binary data - */ - private void receiveTuple(boolean isBinary) throws SQLException - { - if (fields == null) - throw new PSQLException("postgresql.con.tuple"); - Object tuple = pg_stream.ReceiveTuple(fields.length, isBinary); - if (isBinary) - binaryCursor = true; - if (maxRows == 0 || tuples.size() < maxRows) - tuples.addElement(tuple); - } - - /* - * Receive command status from the backend. - */ - private void receiveCommandStatus() throws SQLException - { - - status = pg_stream.ReceiveString(connection.getEncoding()); - - try - { - // Now handle the update count correctly. - if (status.startsWith("INSERT") || status.startsWith("UPDATE") || status.startsWith("DELETE") || status.startsWith("MOVE")) - { - update_count = Integer.parseInt(status.substring(1 + status.lastIndexOf(' '))); - } - if (status.startsWith("INSERT")) - { - insert_oid = Long.parseLong(status.substring(1 + status.indexOf(' '), - status.lastIndexOf(' '))); - } - } - catch (NumberFormatException nfe) - { - throw new PSQLException("postgresql.con.fathom", status); - } - } - - /* - * Receive the field descriptions from the back end. - */ - private void receiveFields() throws SQLException - { - if (fields != null) - throw new PSQLException("postgresql.con.multres"); - - int size = pg_stream.ReceiveIntegerR(2); - fields = new Field[size]; - - for (int i = 0; i < fields.length; i++) - { - String typeName = pg_stream.ReceiveString(connection.getEncoding()); - int typeOid = pg_stream.ReceiveIntegerR(4); - int typeLength = pg_stream.ReceiveIntegerR(2); - int typeModifier = pg_stream.ReceiveIntegerR(4); - fields[i] = new Field(connection, typeName, typeOid, typeLength, typeModifier); - } - } + break; + case 'B': // Binary Data Transfer + receiveTuple(true); + break; + case 'C': // Command Status + receiveCommandStatus(); + break; + case 'D': // Text Data Transfer + receiveTuple(false); + break; + case 'E': // Error Message + + // it's possible to get more than one error message for a query + // see libpq comments wrt backend closing a connection + // so, append messages to a string buffer and keep processing + // check at the bottom to see if we need to throw an exception + + if ( errorMessage == null ) + errorMessage = new StringBuffer(); + + errorMessage.append(pg_stream.ReceiveString(connection.getEncoding())); + // keep processing + break; + case 'I': // Empty Query + int t = pg_stream.ReceiveChar(); + break; + case 'N': // Error Notification + connection.addWarning(pg_stream.ReceiveString(connection.getEncoding())); + break; + case 'P': // Portal Name + String pname = pg_stream.ReceiveString(connection.getEncoding()); + break; + case 'T': // MetaData Field Description + receiveFields(); + break; + case 'Z': + l_endQuery = true; + break; + default: + throw new PSQLException("postgresql.con.type", + new Character((char) c)); + } + + } + + // did we get an error during this query? + if ( errorMessage != null ) + throw new SQLException( errorMessage.toString() ); + + return connection.getResultSet(statement, fields, tuples, status, update_count, insert_oid, binaryCursor); + } + } + + /* + * Send a query to the backend. + */ + private void sendQuery() throws SQLException + { + try + { + pg_stream.SendChar('Q'); + for (int i = 0 ; i < m_binds.length ; ++i) + { + if (m_binds[i] == null) + throw new PSQLException("postgresql.prep.param", new Integer(i + 1)); + pg_stream.Send(connection.getEncoding().encode(m_sqlFrags[i])); + pg_stream.Send(connection.getEncoding().encode(m_binds[i].toString())); + } + pg_stream.Send(connection.getEncoding().encode(m_sqlFrags[m_binds.length])); + pg_stream.SendChar(0); + pg_stream.flush(); + + } + catch (IOException e) + { + throw new PSQLException("postgresql.con.ioerror", e); + } + } + + /* + * Receive a tuple from the backend. + * + * @param isBinary set if the tuple should be treated as binary data + */ + private void receiveTuple(boolean isBinary) throws SQLException + { + if (fields == null) + throw new PSQLException("postgresql.con.tuple"); + Object tuple = pg_stream.ReceiveTuple(fields.length, isBinary); + if (isBinary) + binaryCursor = true; + if (maxRows == 0 || tuples.size() < maxRows) + tuples.addElement(tuple); + } + + /* + * Receive command status from the backend. + */ + private void receiveCommandStatus() throws SQLException + { + + status = pg_stream.ReceiveString(connection.getEncoding()); + + try + { + // Now handle the update count correctly. + if (status.startsWith("INSERT") || status.startsWith("UPDATE") || status.startsWith("DELETE") || status.startsWith("MOVE")) + { + update_count = Integer.parseInt(status.substring(1 + status.lastIndexOf(' '))); + } + if (status.startsWith("INSERT")) + { + insert_oid = Long.parseLong(status.substring(1 + status.indexOf(' '), + status.lastIndexOf(' '))); + } + } + catch (NumberFormatException nfe) + { + throw new PSQLException("postgresql.con.fathom", status); + } + } + + /* + * Receive the field descriptions from the back end. + */ + private void receiveFields() throws SQLException + { + if (fields != null) + throw new PSQLException("postgresql.con.multres"); + + int size = pg_stream.ReceiveIntegerR(2); + fields = new Field[size]; + + for (int i = 0; i < fields.length; i++) + { + String typeName = pg_stream.ReceiveString(connection.getEncoding()); + int typeOid = pg_stream.ReceiveIntegerR(4); + int typeLength = pg_stream.ReceiveIntegerR(2); + int typeModifier = pg_stream.ReceiveIntegerR(4); + fields[i] = new Field(connection, typeName, typeOid, typeLength, typeModifier); + } + } } diff --git a/src/interfaces/jdbc/org/postgresql/core/StartupPacket.java b/src/interfaces/jdbc/org/postgresql/core/StartupPacket.java index 223f16ebd47c3189a0953c8696fa0ac088ab4ed7..38ddc15f44c44168cf48417f0d57e4858a4f6356 100644 --- a/src/interfaces/jdbc/org/postgresql/core/StartupPacket.java +++ b/src/interfaces/jdbc/org/postgresql/core/StartupPacket.java @@ -6,7 +6,7 @@ import java.io.IOException; /** * Sent to the backend to initialize a newly created connection. * - * $Id: StartupPacket.java,v 1.1 2002/03/21 02:40:03 davec Exp $ + * $Id: StartupPacket.java,v 1.2 2002/09/06 21:23:05 momjian Exp $ */ public class StartupPacket @@ -22,15 +22,16 @@ public class StartupPacket private String user; private String database; - public StartupPacket(int protocolMajor, int protocolMinor, String user, String database) { + public StartupPacket(int protocolMajor, int protocolMinor, String user, String database) + { this.protocolMajor = protocolMajor; this.protocolMinor = protocolMinor; this.user = user; this.database = database; } - public void writeTo(PG_Stream stream) throws IOException - { + public void writeTo(PG_Stream stream) throws IOException + { stream.SendInteger(4 + 4 + SM_DATABASE + SM_USER + SM_OPTIONS + SM_UNUSED + SM_TTY, 4); stream.SendInteger(protocolMajor, 2); stream.SendInteger(protocolMinor, 2); diff --git a/src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java b/src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java index d166b10f83b658f48f42801793464ded4efa6660..56676a40ecaa48300a3752ebee9f0ab8ec6a3df5 100644 --- a/src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java +++ b/src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java @@ -24,268 +24,272 @@ import org.postgresql.util.*; */ public class Fastpath { - // This maps the functions names to their id's (possible unique just - // to a connection). - protected Hashtable func = new Hashtable(); + // This maps the functions names to their id's (possible unique just + // to a connection). + protected Hashtable func = new Hashtable(); - protected org.postgresql.PGConnection conn; // our connection - protected org.postgresql.PG_Stream stream; // the network stream + protected org.postgresql.PGConnection conn; // our connection + protected org.postgresql.PG_Stream stream; // the network stream - /* - * Initialises the fastpath system - * - *
Important Notice
- *
This is called from org.postgresql.Connection, and should not be called
- * from client code.
- *
- * @param conn org.postgresql.Connection to attach to
- * @param stream The network stream to the backend
- */
- public Fastpath(org.postgresql.PGConnection conn, org.postgresql.PG_Stream stream)
- {
- this.conn = conn;
- this.stream = stream;
- }
+ /*
+ * Initialises the fastpath system
+ *
+ *
Important Notice
+ *
This is called from org.postgresql.Connection, and should not be called
+ * from client code.
+ *
+ * @param conn org.postgresql.Connection to attach to
+ * @param stream The network stream to the backend
+ */
+ public Fastpath(org.postgresql.PGConnection conn, org.postgresql.PG_Stream stream)
+ {
+ this.conn = conn;
+ this.stream = stream;
+ }
- /*
- * Send a function call to the PostgreSQL backend
- *
- * @param fnid Function id
- * @param resulttype True if the result is an integer, false for other results
- * @param args FastpathArguments to pass to fastpath
- * @return null if no data, Integer if an integer result, or byte[] otherwise
- * @exception SQLException if a database-access error occurs.
- */
- public Object fastpath(int fnid, boolean resulttype, FastpathArg[] args) throws SQLException
- {
- // added Oct 7 1998 to give us thread safety
- synchronized (stream)
- {
- // send the function call
- try
- {
- // 70 is 'F' in ASCII. Note: don't use SendChar() here as it adds padding
- // that confuses the backend. The 0 terminates the command line.
- stream.SendInteger(70, 1);
- stream.SendInteger(0, 1);
+ /*
+ * Send a function call to the PostgreSQL backend
+ *
+ * @param fnid Function id
+ * @param resulttype True if the result is an integer, false for other results
+ * @param args FastpathArguments to pass to fastpath
+ * @return null if no data, Integer if an integer result, or byte[] otherwise
+ * @exception SQLException if a database-access error occurs.
+ */
+ public Object fastpath(int fnid, boolean resulttype, FastpathArg[] args) throws SQLException
+ {
+ // added Oct 7 1998 to give us thread safety
+ synchronized (stream)
+ {
+ // send the function call
+ try
+ {
+ // 70 is 'F' in ASCII. Note: don't use SendChar() here as it adds padding
+ // that confuses the backend. The 0 terminates the command line.
+ stream.SendInteger(70, 1);
+ stream.SendInteger(0, 1);
- stream.SendInteger(fnid, 4);
- stream.SendInteger(args.length, 4);
+ stream.SendInteger(fnid, 4);
+ stream.SendInteger(args.length, 4);
- for (int i = 0;i < args.length;i++)
- args[i].send(stream);
+ for (int i = 0;i < args.length;i++)
+ args[i].send(stream);
- // This is needed, otherwise data can be lost
- stream.flush();
+ // This is needed, otherwise data can be lost
+ stream.flush();
- }
- catch (IOException ioe)
- {
- throw new PSQLException("postgresql.fp.send", new Integer(fnid), ioe);
- }
+ }
+ catch (IOException ioe)
+ {
+ throw new PSQLException("postgresql.fp.send", new Integer(fnid), ioe);
+ }
- // Now handle the result
+ // Now handle the result
- // Now loop, reading the results
- Object result = null; // our result
- StringBuffer errorMessage = null;
- int c;
- boolean l_endQuery = false;
- while (!l_endQuery)
- {
- c = stream.ReceiveChar();
+ // Now loop, reading the results
+ Object result = null; // our result
+ StringBuffer errorMessage = null;
+ int c;
+ boolean l_endQuery = false;
+ while (!l_endQuery)
+ {
+ c = stream.ReceiveChar();
- switch (c)
- {
- case 'A': // Asynchronous Notify
- int pid = stream.ReceiveInteger(4);
- String msg = stream.ReceiveString(conn.getEncoding());
- break;
+ switch (c)
+ {
+ case 'A': // Asynchronous Notify
+ int pid = stream.ReceiveInteger(4);
+ String msg = stream.ReceiveString(conn.getEncoding());
+ break;
- //------------------------------
- // Error message returned
- case 'E':
- if ( errorMessage == null )
- errorMessage = new StringBuffer();
- errorMessage.append(stream.ReceiveString(conn.getEncoding()));
- break;
+ //------------------------------
+ // Error message returned
+ case 'E':
+ if ( errorMessage == null )
+ errorMessage = new StringBuffer();
+ errorMessage.append(stream.ReceiveString(conn.getEncoding()));
+ break;
- //------------------------------
- // Notice from backend
- case 'N':
- ((org.postgresql.jdbc1.AbstractJdbc1Connection)conn).addWarning(stream.ReceiveString(conn.getEncoding()));
- break;
+ //------------------------------
+ // Notice from backend
+ case 'N':
+ ((org.postgresql.jdbc1.AbstractJdbc1Connection)conn).addWarning(stream.ReceiveString(conn.getEncoding()));
+ break;
- case 'V':
- int l_nextChar = stream.ReceiveChar();
- if (l_nextChar == 'G') {
- int sz = stream.ReceiveIntegerR(4);
- // Return an Integer if
- if (resulttype)
- result = new Integer(stream.ReceiveIntegerR(sz));
- else
- {
- byte buf[] = new byte[sz];
- stream.Receive(buf, 0, sz);
- result = buf;
- }
- //There should be a trailing '0'
- int l_endChar = stream.ReceiveChar();
- } else {
- //it must have been a '0', thus no results
- }
- break;
+ case 'V':
+ int l_nextChar = stream.ReceiveChar();
+ if (l_nextChar == 'G')
+ {
+ int sz = stream.ReceiveIntegerR(4);
+ // Return an Integer if
+ if (resulttype)
+ result = new Integer(stream.ReceiveIntegerR(sz));
+ else
+ {
+ byte buf[] = new byte[sz];
+ stream.Receive(buf, 0, sz);
+ result = buf;
+ }
+ //There should be a trailing '0'
+ int l_endChar = stream.ReceiveChar();
+ }
+ else
+ {
+ //it must have been a '0', thus no results
+ }
+ break;
- case 'Z':
- l_endQuery = true;
- break;
+ case 'Z':
+ l_endQuery = true;
+ break;
- default:
- throw new PSQLException("postgresql.fp.protocol", new Character((char)c));
- }
- }
+ default:
+ throw new PSQLException("postgresql.fp.protocol", new Character((char)c));
+ }
+ }
- if ( errorMessage != null )
- throw new PSQLException("postgresql.fp.error", errorMessage.toString());
+ if ( errorMessage != null )
+ throw new PSQLException("postgresql.fp.error", errorMessage.toString());
- return result;
- }
- }
+ return result;
+ }
+ }
- /*
- * Send a function call to the PostgreSQL backend by name.
- *
- * Note: the mapping for the procedure name to function id needs to exist,
- * usually to an earlier call to addfunction().
- *
- * This is the prefered method to call, as function id's can/may change
- * between versions of the backend.
- *
- * For an example of how this works, refer to org.postgresql.LargeObject
- *
- * @param name Function name
- * @param resulttype True if the result is an integer, false for other
- * results
- * @param args FastpathArguments to pass to fastpath
- * @return null if no data, Integer if an integer result, or byte[] otherwise
- * @exception SQLException if name is unknown or if a database-access error
- * occurs.
- * @see org.postgresql.LargeObject
- */
- public Object fastpath(String name, boolean resulttype, FastpathArg[] args) throws SQLException
- {
- if (Driver.logDebug) Driver.debug("Fastpath: calling "+name);
- return fastpath(getID(name), resulttype, args);
- }
+ /*
+ * Send a function call to the PostgreSQL backend by name.
+ *
+ * Note: the mapping for the procedure name to function id needs to exist,
+ * usually to an earlier call to addfunction().
+ *
+ * This is the prefered method to call, as function id's can/may change
+ * between versions of the backend.
+ *
+ * For an example of how this works, refer to org.postgresql.LargeObject
+ *
+ * @param name Function name
+ * @param resulttype True if the result is an integer, false for other
+ * results
+ * @param args FastpathArguments to pass to fastpath
+ * @return null if no data, Integer if an integer result, or byte[] otherwise
+ * @exception SQLException if name is unknown or if a database-access error
+ * occurs.
+ * @see org.postgresql.LargeObject
+ */
+ public Object fastpath(String name, boolean resulttype, FastpathArg[] args) throws SQLException
+ {
+ if (Driver.logDebug)
+ Driver.debug("Fastpath: calling " + name);
+ return fastpath(getID(name), resulttype, args);
+ }
- /*
- * This convenience method assumes that the return value is an Integer
- * @param name Function name
- * @param args Function arguments
- * @return integer result
- * @exception SQLException if a database-access error occurs or no result
- */
- public int getInteger(String name, FastpathArg[] args) throws SQLException
- {
- Integer i = (Integer)fastpath(name, true, args);
- if (i == null)
- throw new PSQLException("postgresql.fp.expint", name);
- return i.intValue();
- }
+ /*
+ * This convenience method assumes that the return value is an Integer
+ * @param name Function name
+ * @param args Function arguments
+ * @return integer result
+ * @exception SQLException if a database-access error occurs or no result
+ */
+ public int getInteger(String name, FastpathArg[] args) throws SQLException
+ {
+ Integer i = (Integer)fastpath(name, true, args);
+ if (i == null)
+ throw new PSQLException("postgresql.fp.expint", name);
+ return i.intValue();
+ }
- /*
- * This convenience method assumes that the return value is an Integer
- * @param name Function name
- * @param args Function arguments
- * @return byte[] array containing result
- * @exception SQLException if a database-access error occurs or no result
- */
- public byte[] getData(String name, FastpathArg[] args) throws SQLException
- {
- return (byte[])fastpath(name, false, args);
- }
+ /*
+ * This convenience method assumes that the return value is an Integer
+ * @param name Function name
+ * @param args Function arguments
+ * @return byte[] array containing result
+ * @exception SQLException if a database-access error occurs or no result
+ */
+ public byte[] getData(String name, FastpathArg[] args) throws SQLException
+ {
+ return (byte[])fastpath(name, false, args);
+ }
- /*
- * This adds a function to our lookup table.
- *
- *
User code should use the addFunctions method, which is based upon a - * query, rather than hard coding the oid. The oid for a function is not - * guaranteed to remain static, even on different servers of the same - * version. - * - * @param name Function name - * @param fnid Function id - */ - public void addFunction(String name, int fnid) - { - func.put(name, new Integer(fnid)); - } + /* + * This adds a function to our lookup table. + * + *
User code should use the addFunctions method, which is based upon a + * query, rather than hard coding the oid. The oid for a function is not + * guaranteed to remain static, even on different servers of the same + * version. + * + * @param name Function name + * @param fnid Function id + */ + public void addFunction(String name, int fnid) + { + func.put(name, new Integer(fnid)); + } - /* - * This takes a ResultSet containing two columns. Column 1 contains the - * function name, Column 2 the oid. - * - *
It reads the entire ResultSet, loading the values into the function - * table. - * - *
REMEMBER to close() the resultset after calling this!! - * - *
Implementation note about function name lookups: - * - *
PostgreSQL stores the function id's and their corresponding names in - * the pg_proc table. To speed things up locally, instead of querying each - * function from that table when required, a Hashtable is used. Also, only - * the function's required are entered into this table, keeping connection - * times as fast as possible. - * - *
The org.postgresql.LargeObject class performs a query upon it's startup, - * and passes the returned ResultSet to the addFunctions() method here. - * - *
Once this has been done, the LargeObject api refers to the functions by - * name. - * - *
Dont think that manually converting them to the oid's will work. Ok, - * they will for now, but they can change during development (there was some - * discussion about this for V7.0), so this is implemented to prevent any - * unwarranted headaches in the future. - * - * @param rs ResultSet - * @exception SQLException if a database-access error occurs. - * @see org.postgresql.LargeObjectManager - */ - public void addFunctions(ResultSet rs) throws SQLException - { - while (rs.next()) - { - func.put(rs.getString(1), new Integer(rs.getInt(2))); - } - } + /* + * This takes a ResultSet containing two columns. Column 1 contains the + * function name, Column 2 the oid. + * + *
It reads the entire ResultSet, loading the values into the function + * table. + * + *
REMEMBER to close() the resultset after calling this!! + * + *
Implementation note about function name lookups: + * + *
PostgreSQL stores the function id's and their corresponding names in + * the pg_proc table. To speed things up locally, instead of querying each + * function from that table when required, a Hashtable is used. Also, only + * the function's required are entered into this table, keeping connection + * times as fast as possible. + * + *
The org.postgresql.LargeObject class performs a query upon it's startup, + * and passes the returned ResultSet to the addFunctions() method here. + * + *
Once this has been done, the LargeObject api refers to the functions by + * name. + * + *
Dont think that manually converting them to the oid's will work. Ok, + * they will for now, but they can change during development (there was some + * discussion about this for V7.0), so this is implemented to prevent any + * unwarranted headaches in the future. + * + * @param rs ResultSet + * @exception SQLException if a database-access error occurs. + * @see org.postgresql.LargeObjectManager + */ + public void addFunctions(ResultSet rs) throws SQLException + { + while (rs.next()) + { + func.put(rs.getString(1), new Integer(rs.getInt(2))); + } + } - /* - * This returns the function id associated by its name - * - *
If addFunction() or addFunctions() have not been called for this name, - * then an SQLException is thrown. - * - * @param name Function name to lookup - * @return Function ID for fastpath call - * @exception SQLException is function is unknown. - */ - public int getID(String name) throws SQLException - { - Integer id = (Integer)func.get(name); + /* + * This returns the function id associated by its name + * + *
If addFunction() or addFunctions() have not been called for this name,
+ * then an SQLException is thrown.
+ *
+ * @param name Function name to lookup
+ * @return Function ID for fastpath call
+ * @exception SQLException is function is unknown.
+ */
+ public int getID(String name) throws SQLException
+ {
+ Integer id = (Integer)func.get(name);
- // may be we could add a lookup to the database here, and store the result
- // in our lookup table, throwing the exception if that fails.
- // We must, however, ensure that if we do, any existing ResultSet is
- // unaffected, otherwise we could break user code.
- //
- // so, until we know we can do this (needs testing, on the TODO list)
- // for now, we throw the exception and do no lookups.
- if (id == null)
- throw new PSQLException("postgresql.fp.unknown", name);
+ // may be we could add a lookup to the database here, and store the result
+ // in our lookup table, throwing the exception if that fails.
+ // We must, however, ensure that if we do, any existing ResultSet is
+ // unaffected, otherwise we could break user code.
+ //
+ // so, until we know we can do this (needs testing, on the TODO list)
+ // for now, we throw the exception and do no lookups.
+ if (id == null)
+ throw new PSQLException("postgresql.fp.unknown", name);
- return id.intValue();
- }
+ return id.intValue();
+ }
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
index 4721acc4353f7210510bdbad1ade2e82ebd1f988..45160ba34fc6fecc5350ea56df0a524ecda5097a 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
@@ -14,1218 +14,1237 @@ import org.postgresql.largeobject.LargeObjectManager;
import org.postgresql.util.*;
-/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.7 2002/09/02 03:07:36 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.8 2002/09/06 21:23:05 momjian Exp $
* This class defines methods of the jdbc1 specification. This class is
* extended by org.postgresql.jdbc2.AbstractJdbc2Connection which adds the jdbc2
* methods. The real Connection class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Connection
*/
public abstract class AbstractJdbc1Connection implements org.postgresql.PGConnection
{
- // This is the network stream associated with this connection
- public PG_Stream pg_stream;
-
- protected String PG_HOST;
- protected int PG_PORT;
- protected String PG_USER;
- protected String PG_DATABASE;
- protected boolean PG_STATUS;
- protected String compatible;
-
- // The PID an cancellation key we get from the backend process
- protected int pid;
- protected int ckey;
-
- private Vector m_notifications;
-
- /*
- The encoding to use for this connection.
- */
- private Encoding encoding = Encoding.defaultEncoding();
-
- private String dbVersionNumber;
-
- public boolean CONNECTION_OK = true;
- public boolean CONNECTION_BAD = false;
-
- public boolean autoCommit = true;
- public boolean readOnly = false;
-
- public org.postgresql.Driver this_driver;
- private String this_url;
- private String cursor = null; // The positioned update cursor name
-
- // These are new for v6.3, they determine the current protocol versions
- // supported by this version of the driver. They are defined in
- // src/include/libpq/pqcomm.h
- protected static final int PG_PROTOCOL_LATEST_MAJOR = 2;
- protected static final int PG_PROTOCOL_LATEST_MINOR = 0;
-
- private static final int AUTH_REQ_OK = 0;
- private static final int AUTH_REQ_KRB4 = 1;
- private static final int AUTH_REQ_KRB5 = 2;
- private static final int AUTH_REQ_PASSWORD = 3;
- private static final int AUTH_REQ_CRYPT = 4;
- private static final int AUTH_REQ_MD5 = 5;
-
-
- // These are used to cache oids, PGTypes and SQLTypes
- private static Hashtable sqlTypeCache = new Hashtable(); // oid -> SQLType
- private static Hashtable pgTypeCache = new Hashtable(); // oid -> PGType
- private static Hashtable typeOidCache = new Hashtable(); //PGType -> oid
-
- // Now handle notices as warnings, so things like "show" now work
- public SQLWarning firstWarning = null;
-
- /*
- * Cache of the current isolation level
- */
- private int isolationLevel = java.sql.Connection.TRANSACTION_READ_COMMITTED;
-
-
- public abstract java.sql.Statement createStatement() throws SQLException;
-
-
- /*
- * This method actually opens the connection. It is called by Driver.
- *
- * @param host the hostname of the database back end
- * @param port the port number of the postmaster process
- * @param info a Properties[] thing of the user and password
- * @param database the database to connect to
- * @param url the URL of the connection
- * @param d the Driver instantation of the connection
- * @exception SQLException if a database access error occurs
- */
- public void openConnection(String host, int port, Properties info, String database, String url, org.postgresql.Driver d) throws SQLException
- {
- firstWarning = null;
-
- // Throw an exception if the user or password properties are missing
- // This occasionally occurs when the client uses the properties version
- // of getConnection(), and is a common question on the email lists
- if (info.getProperty("user") == null)
- throw new PSQLException("postgresql.con.user");
-
- this_driver = (org.postgresql.Driver)d;
- this_url = url;
-
- PG_DATABASE = database;
- PG_USER = info.getProperty("user");
-
- String password = info.getProperty("password", "");
- PG_PORT = port;
-
- PG_HOST = host;
- PG_STATUS = CONNECTION_BAD;
-
- if (info.getProperty("compatible") == null)
- {
- compatible = d.getMajorVersion() + "." + d.getMinorVersion();
- }
- else
- {
- compatible = info.getProperty("compatible");
- }
-
- //Read loglevel arg and set the loglevel based on this value
- //in addition to setting the log level enable output to
- //standard out if no other printwriter is set
- String l_logLevelProp = info.getProperty("loglevel","0");
- int l_logLevel = 0;
- try {
- l_logLevel = Integer.parseInt(l_logLevelProp);
- if (l_logLevel > org.postgresql.Driver.DEBUG || l_logLevel < org.postgresql.Driver.INFO) {
- l_logLevel = 0;
- }
- } catch (Exception l_e) {
- //invalid value for loglevel ignore
+ // This is the network stream associated with this connection
+ public PG_Stream pg_stream;
+
+ protected String PG_HOST;
+ protected int PG_PORT;
+ protected String PG_USER;
+ protected String PG_DATABASE;
+ protected boolean PG_STATUS;
+ protected String compatible;
+
+ // The PID an cancellation key we get from the backend process
+ protected int pid;
+ protected int ckey;
+
+ private Vector m_notifications;
+
+ /*
+ The encoding to use for this connection.
+ */
+ private Encoding encoding = Encoding.defaultEncoding();
+
+ private String dbVersionNumber;
+
+ public boolean CONNECTION_OK = true;
+ public boolean CONNECTION_BAD = false;
+
+ public boolean autoCommit = true;
+ public boolean readOnly = false;
+
+ public org.postgresql.Driver this_driver;
+ private String this_url;
+ private String cursor = null; // The positioned update cursor name
+
+ // These are new for v6.3, they determine the current protocol versions
+ // supported by this version of the driver. They are defined in
+ // src/include/libpq/pqcomm.h
+ protected static final int PG_PROTOCOL_LATEST_MAJOR = 2;
+ protected static final int PG_PROTOCOL_LATEST_MINOR = 0;
+
+ private static final int AUTH_REQ_OK = 0;
+ private static final int AUTH_REQ_KRB4 = 1;
+ private static final int AUTH_REQ_KRB5 = 2;
+ private static final int AUTH_REQ_PASSWORD = 3;
+ private static final int AUTH_REQ_CRYPT = 4;
+ private static final int AUTH_REQ_MD5 = 5;
+
+
+ // These are used to cache oids, PGTypes and SQLTypes
+ private static Hashtable sqlTypeCache = new Hashtable(); // oid -> SQLType
+ private static Hashtable pgTypeCache = new Hashtable(); // oid -> PGType
+ private static Hashtable typeOidCache = new Hashtable(); //PGType -> oid
+
+ // Now handle notices as warnings, so things like "show" now work
+ public SQLWarning firstWarning = null;
+
+ /*
+ * Cache of the current isolation level
+ */
+ private int isolationLevel = java.sql.Connection.TRANSACTION_READ_COMMITTED;
+
+
+ public abstract java.sql.Statement createStatement() throws SQLException;
+
+
+ /*
+ * This method actually opens the connection. It is called by Driver.
+ *
+ * @param host the hostname of the database back end
+ * @param port the port number of the postmaster process
+ * @param info a Properties[] thing of the user and password
+ * @param database the database to connect to
+ * @param url the URL of the connection
+ * @param d the Driver instantation of the connection
+ * @exception SQLException if a database access error occurs
+ */
+ public void openConnection(String host, int port, Properties info, String database, String url, org.postgresql.Driver d) throws SQLException
+ {
+ firstWarning = null;
+
+ // Throw an exception if the user or password properties are missing
+ // This occasionally occurs when the client uses the properties version
+ // of getConnection(), and is a common question on the email lists
+ if (info.getProperty("user") == null)
+ throw new PSQLException("postgresql.con.user");
+
+ this_driver = (org.postgresql.Driver)d;
+ this_url = url;
+
+ PG_DATABASE = database;
+ PG_USER = info.getProperty("user");
+
+ String password = info.getProperty("password", "");
+ PG_PORT = port;
+
+ PG_HOST = host;
+ PG_STATUS = CONNECTION_BAD;
+
+ if (info.getProperty("compatible") == null)
+ {
+ compatible = d.getMajorVersion() + "." + d.getMinorVersion();
+ }
+ else
+ {
+ compatible = info.getProperty("compatible");
+ }
+
+ //Read loglevel arg and set the loglevel based on this value
+ //in addition to setting the log level enable output to
+ //standard out if no other printwriter is set
+ String l_logLevelProp = info.getProperty("loglevel", "0");
+ int l_logLevel = 0;
+ try
+ {
+ l_logLevel = Integer.parseInt(l_logLevelProp);
+ if (l_logLevel > org.postgresql.Driver.DEBUG || l_logLevel < org.postgresql.Driver.INFO)
+ {
+ l_logLevel = 0;
+ }
+ }
+ catch (Exception l_e)
+ {
+ //invalid value for loglevel ignore
+ }
+ if (l_logLevel > 0)
+ {
+ org.postgresql.Driver.setLogLevel(l_logLevel);
+ enableDriverManagerLogging();
+ }
+
+ //Print out the driver version number
+ if (org.postgresql.Driver.logInfo)
+ org.postgresql.Driver.info(org.postgresql.Driver.getVersion());
+
+ // Now make the initial connection
+ try
+ {
+ pg_stream = new PG_Stream(host, port);
+ }
+ catch (ConnectException cex)
+ {
+ // Added by Peter Mount NOTE: This is not part of JDBC, but allows access to
+ * functions on the org.postgresql backend itself.
+ *
+ * It is primarily used by the LargeObject API
+ *
+ * The best way to use this is as follows:
+ *
+ * where myconn is an open Connection to org.postgresql.
+ *
+ * @return Fastpath object allowing access to functions on the org.postgresql
+ * backend.
+ * @exception SQLException by Fastpath when initialising for first time
+ */
+ public Fastpath getFastpathAPI() throws SQLException
+ {
+ if (fastpath == null)
+ fastpath = new Fastpath(this, pg_stream);
+ return fastpath;
+ }
+
+ // This holds a reference to the Fastpath API if already open
+ private Fastpath fastpath = null;
+
+ /*
+ * This returns the LargeObject API for the current connection.
+ *
+ * NOTE: This is not part of JDBC, but allows access to
+ * functions on the org.postgresql backend itself.
+ *
+ * The best way to use this is as follows:
+ *
+ * where myconn is an open Connection to org.postgresql.
+ *
+ * @return LargeObject object that implements the API
+ * @exception SQLException by LargeObject when initialising for first time
+ */
+ public LargeObjectManager getLargeObjectAPI() throws SQLException
+ {
+ if (largeobject == null)
+ largeobject = new LargeObjectManager((java.sql.Connection)this);
+ return largeobject;
+ }
+
+ // This holds a reference to the LargeObject API if already open
+ private LargeObjectManager largeobject = null;
+
+ /*
+ * This method is used internally to return an object based around
+ * org.postgresql's more unique data types.
+ *
+ * It uses an internal Hashtable to get the handling class. If the
+ * type is not supported, then an instance of org.postgresql.util.PGobject
+ * is returned.
+ *
+ * You can use the getValue() or setValue() methods to handle the returned
+ * object. Custom objects can have their own methods.
+ *
+ * In 6.4, this is extended to use the org.postgresql.util.Serialize class to
+ * allow the Serialization of Java Objects into the database without using
+ * Blobs. Refer to that class for details on how this new feature works.
+ *
+ * @return PGobject for this type, and set to value
+ * @exception SQLException if value is not correct for this type
+ * @see org.postgresql.util.Serialize
+ */
+ public Object getObject(String type, String value) throws SQLException
+ {
+ try
+ {
+ Object o = objectTypes.get(type);
+
+ // If o is null, then the type is unknown, so check to see if type
+ // is an actual table name. If it does, see if a Class is known that
+ // can handle it
+ if (o == null)
+ {
+ Serialize ser = new Serialize((java.sql.Connection)this, type);
+ objectTypes.put(type, ser);
+ return ser.fetch(Integer.parseInt(value));
+ }
+
+ // If o is not null, and it is a String, then its a class name that
+ // extends PGobject.
+ //
+ // This is used to implement the org.postgresql unique types (like lseg,
+ // point, etc).
+ if (o instanceof String)
+ {
+ // 6.3 style extending PG_Object
+ PGobject obj = null;
+ obj = (PGobject)(Class.forName((String)o).newInstance());
+ obj.setType(type);
+ obj.setValue(value);
+ return (Object)obj;
+ }
+ else
+ {
+ // If it's an object, it should be an instance of our Serialize class
+ // If so, then call it's fetch method.
+ if (o instanceof Serialize)
+ return ((Serialize)o).fetch(Integer.parseInt(value));
+ }
+ }
+ catch (SQLException sx)
+ {
+ // rethrow the exception. Done because we capture any others next
+ sx.fillInStackTrace();
+ throw sx;
+ }
+ catch (Exception ex)
+ {
+ throw new PSQLException("postgresql.con.creobj", type, ex);
+ }
+
+ // should never be reached
+ return null;
+ }
+
+ /*
+ * This stores an object into the database. This method was
+ * deprecated in 7.2 bacause an OID can be larger than the java signed
+ * int returned by this method.
+ * @deprecated Replaced by storeObject() in 7.2
+ */
+ public int putObject(Object o) throws SQLException
+ {
+ return (int) storeObject(o);
+ }
+
+ /*
+ * This stores an object into the database.
+ * @param o Object to store
+ * @return OID of the new rectord
+ * @exception SQLException if value is not correct for this type
+ * @see org.postgresql.util.Serialize
+ * @since 7.2
+ */
+ public long storeObject(Object o) throws SQLException
+ {
+ try
+ {
+ String type = o.getClass().getName();
+ Object x = objectTypes.get(type);
+
+ // If x is null, then the type is unknown, so check to see if type
+ // is an actual table name. If it does, see if a Class is known that
+ // can handle it
+ if (x == null)
+ {
+ Serialize ser = new Serialize((java.sql.Connection)this, type);
+ objectTypes.put(type, ser);
+ return ser.storeObject(o);
+ }
+
+ // If it's an object, it should be an instance of our Serialize class
+ // If so, then call it's fetch method.
+ if (x instanceof Serialize)
+ return ((Serialize)x).storeObject(o);
+
+ // Thow an exception because the type is unknown
+ throw new PSQLException("postgresql.con.strobj");
+
+ }
+ catch (SQLException sx)
+ {
+ // rethrow the exception. Done because we capture any others next
+ sx.fillInStackTrace();
+ throw sx;
}
- if (l_logLevel > 0) {
- org.postgresql.Driver.setLogLevel(l_logLevel);
- enableDriverManagerLogging();
+ catch (Exception ex)
+ {
+ throw new PSQLException("postgresql.con.strobjex", ex);
}
+ }
- //Print out the driver version number
- if (org.postgresql.Driver.logInfo) org.postgresql.Driver.info(org.postgresql.Driver.getVersion());
-
- // Now make the initial connection
- try
- {
- pg_stream = new PG_Stream(host, port);
- }
- catch (ConnectException cex)
- {
- // Added by Peter Mount NOTE: This is not part of JDBC, but an extension.
+ *
+ * The best way to use this is as follows:
+ *
+ * where myconn is an open Connection to org.postgresql.
+ *
+ * The handling class must extend org.postgresql.util.PGobject
+ *
+ * @see org.postgresql.util.PGobject
+ */
+ public void addDataType(String type, String name)
+ {
+ objectTypes.put(type, name);
}
- // These methods used to be in the main Connection implementation. As they
- // are common to all implementations (JDBC1 or 2), they are placed here.
- // This should make it easy to maintain the two specifications.
-
- public abstract java.sql.ResultSet getResultSet(Statement statement, org.postgresql.Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException;
-
- public abstract java.sql.ResultSet getResultSet(Statement statement, org.postgresql.Field[] fields, Vector tuples, String status, int updateCount) throws SQLException;
-
- /*
- * This adds a warning to the warning chain.
- * @param msg message to add
- */
- public void addWarning(String msg)
- {
- // Add the warning to the chain
- if (firstWarning != null)
- firstWarning.setNextWarning(new SQLWarning(msg));
- else
- firstWarning = new SQLWarning(msg);
-
- // Now check for some specific messages
-
- // This is obsolete in 6.5, but I've left it in here so if we need to use this
- // technique again, we'll know where to place it.
- //
- // This is generated by the SQL "show datestyle"
- //if (msg.startsWith("NOTICE:") && msg.indexOf("DateStyle")>0) {
- //// 13 is the length off "DateStyle is "
- //msg = msg.substring(msg.indexOf("DateStyle is ")+13);
- //
- //for(int i=0;i NOTE: This is not part of JDBC, but allows access to
- * functions on the org.postgresql backend itself.
- *
- * It is primarily used by the LargeObject API
- *
- * The best way to use this is as follows:
- *
- * where myconn is an open Connection to org.postgresql.
- *
- * @return Fastpath object allowing access to functions on the org.postgresql
- * backend.
- * @exception SQLException by Fastpath when initialising for first time
- */
- public Fastpath getFastpathAPI() throws SQLException
- {
- if (fastpath == null)
- fastpath = new Fastpath(this, pg_stream);
- return fastpath;
- }
-
- // This holds a reference to the Fastpath API if already open
- private Fastpath fastpath = null;
-
- /*
- * This returns the LargeObject API for the current connection.
- *
- * NOTE: This is not part of JDBC, but allows access to
- * functions on the org.postgresql backend itself.
- *
- * The best way to use this is as follows:
- *
- * where myconn is an open Connection to org.postgresql.
- *
- * @return LargeObject object that implements the API
- * @exception SQLException by LargeObject when initialising for first time
- */
- public LargeObjectManager getLargeObjectAPI() throws SQLException
- {
- if (largeobject == null)
- largeobject = new LargeObjectManager((java.sql.Connection)this);
- return largeobject;
- }
-
- // This holds a reference to the LargeObject API if already open
- private LargeObjectManager largeobject = null;
-
- /*
- * This method is used internally to return an object based around
- * org.postgresql's more unique data types.
- *
- * It uses an internal Hashtable to get the handling class. If the
- * type is not supported, then an instance of org.postgresql.util.PGobject
- * is returned.
- *
- * You can use the getValue() or setValue() methods to handle the returned
- * object. Custom objects can have their own methods.
- *
- * In 6.4, this is extended to use the org.postgresql.util.Serialize class to
- * allow the Serialization of Java Objects into the database without using
- * Blobs. Refer to that class for details on how this new feature works.
- *
- * @return PGobject for this type, and set to value
- * @exception SQLException if value is not correct for this type
- * @see org.postgresql.util.Serialize
- */
- public Object getObject(String type, String value) throws SQLException
- {
- try
- {
- Object o = objectTypes.get(type);
-
- // If o is null, then the type is unknown, so check to see if type
- // is an actual table name. If it does, see if a Class is known that
- // can handle it
- if (o == null)
- {
- Serialize ser = new Serialize((java.sql.Connection)this, type);
- objectTypes.put(type, ser);
- return ser.fetch(Integer.parseInt(value));
- }
-
- // If o is not null, and it is a String, then its a class name that
- // extends PGobject.
- //
- // This is used to implement the org.postgresql unique types (like lseg,
- // point, etc).
- if (o instanceof String)
- {
- // 6.3 style extending PG_Object
- PGobject obj = null;
- obj = (PGobject)(Class.forName((String)o).newInstance());
- obj.setType(type);
- obj.setValue(value);
- return (Object)obj;
- }
- else
- {
- // If it's an object, it should be an instance of our Serialize class
- // If so, then call it's fetch method.
- if (o instanceof Serialize)
- return ((Serialize)o).fetch(Integer.parseInt(value));
- }
- }
- catch (SQLException sx)
- {
- // rethrow the exception. Done because we capture any others next
- sx.fillInStackTrace();
- throw sx;
- }
- catch (Exception ex)
- {
- throw new PSQLException("postgresql.con.creobj", type, ex);
- }
-
- // should never be reached
- return null;
- }
-
- /*
- * This stores an object into the database. This method was
- * deprecated in 7.2 bacause an OID can be larger than the java signed
- * int returned by this method.
- * @deprecated Replaced by storeObject() in 7.2
- */
- public int putObject(Object o) throws SQLException
- {
- return (int) storeObject(o);
- }
-
- /*
- * This stores an object into the database.
- * @param o Object to store
- * @return OID of the new rectord
- * @exception SQLException if value is not correct for this type
- * @see org.postgresql.util.Serialize
- * @since 7.2
- */
- public long storeObject(Object o) throws SQLException
- {
- try
- {
- String type = o.getClass().getName();
- Object x = objectTypes.get(type);
-
- // If x is null, then the type is unknown, so check to see if type
- // is an actual table name. If it does, see if a Class is known that
- // can handle it
- if (x == null)
- {
- Serialize ser = new Serialize((java.sql.Connection)this, type);
- objectTypes.put(type, ser);
- return ser.storeObject(o);
- }
-
- // If it's an object, it should be an instance of our Serialize class
- // If so, then call it's fetch method.
- if (x instanceof Serialize)
- return ((Serialize)x).storeObject(o);
-
- // Thow an exception because the type is unknown
- throw new PSQLException("postgresql.con.strobj");
-
- }
- catch (SQLException sx)
- {
- // rethrow the exception. Done because we capture any others next
- sx.fillInStackTrace();
- throw sx;
- }
- catch (Exception ex)
- {
- throw new PSQLException("postgresql.con.strobjex", ex);
- }
- }
-
- /*
- * This allows client code to add a handler for one of org.postgresql's
- * more unique data types.
- *
- * NOTE: This is not part of JDBC, but an extension.
- *
- * The best way to use this is as follows:
- *
- * where myconn is an open Connection to org.postgresql.
- *
- * The handling class must extend org.postgresql.util.PGobject
- *
- * @see org.postgresql.util.PGobject
- */
- public void addDataType(String type, String name)
- {
- objectTypes.put(type, name);
- }
-
- // This holds the available types
- private Hashtable objectTypes = new Hashtable();
-
- // This array contains the types that are supported as standard.
- //
- // The first entry is the types name on the database, the second
- // the full class name of the handling class.
- //
- private static final String defaultObjectTypes[][] = {
- {"box", "org.postgresql.geometric.PGbox"},
- {"circle", "org.postgresql.geometric.PGcircle"},
- {"line", "org.postgresql.geometric.PGline"},
- {"lseg", "org.postgresql.geometric.PGlseg"},
- {"path", "org.postgresql.geometric.PGpath"},
- {"point", "org.postgresql.geometric.PGpoint"},
- {"polygon", "org.postgresql.geometric.PGpolygon"},
- {"money", "org.postgresql.util.PGmoney"}
- };
-
- // This initialises the objectTypes hashtable
- private void initObjectTypes()
- {
- for (int i = 0;i < defaultObjectTypes.length;i++)
- objectTypes.put(defaultObjectTypes[i][0], defaultObjectTypes[i][1]);
- }
-
- /*
- * In some cases, it is desirable to immediately release a Connection's
- * database and JDBC resources instead of waiting for them to be
- * automatically released (cant think why off the top of my head)
- *
- * Note: A Connection is automatically closed when it is
- * garbage collected. Certain fatal errors also result in a closed
- * connection.
- *
- * @exception SQLException if a database access error occurs
- */
- public void close() throws SQLException
- {
- if (pg_stream != null)
- {
- try
- {
- pg_stream.SendChar('X');
- pg_stream.flush();
- pg_stream.close();
- }
- catch (IOException e)
- {}
+ // This holds the available types
+ private Hashtable objectTypes = new Hashtable();
+
+ // This array contains the types that are supported as standard.
+ //
+ // The first entry is the types name on the database, the second
+ // the full class name of the handling class.
+ //
+ private static final String defaultObjectTypes[][] = {
+ {"box", "org.postgresql.geometric.PGbox"},
+ {"circle", "org.postgresql.geometric.PGcircle"},
+ {"line", "org.postgresql.geometric.PGline"},
+ {"lseg", "org.postgresql.geometric.PGlseg"},
+ {"path", "org.postgresql.geometric.PGpath"},
+ {"point", "org.postgresql.geometric.PGpoint"},
+ {"polygon", "org.postgresql.geometric.PGpolygon"},
+ {"money", "org.postgresql.util.PGmoney"}
+ };
+
+ // This initialises the objectTypes hashtable
+ private void initObjectTypes()
+ {
+ for (int i = 0;i < defaultObjectTypes.length;i++)
+ objectTypes.put(defaultObjectTypes[i][0], defaultObjectTypes[i][1]);
+ }
+
+ /*
+ * In some cases, it is desirable to immediately release a Connection's
+ * database and JDBC resources instead of waiting for them to be
+ * automatically released (cant think why off the top of my head)
+ *
+ * Note: A Connection is automatically closed when it is
+ * garbage collected. Certain fatal errors also result in a closed
+ * connection.
+ *
+ * @exception SQLException if a database access error occurs
+ */
+ public void close() throws SQLException
+ {
+ if (pg_stream != null)
+ {
+ try
+ {
+ pg_stream.SendChar('X');
+ pg_stream.flush();
+ pg_stream.close();
+ }
+ catch (IOException e)
+ {}
finally
{
- pg_stream = null;
+ pg_stream = null;
}
- }
- }
-
- /*
- * A driver may convert the JDBC sql grammar into its system's
- * native SQL grammar prior to sending it; nativeSQL returns the
- * native form of the statement that the driver would have sent.
- *
- * @param sql a SQL statement that may contain one or more '?'
- * parameter placeholders
- * @return the native form of this statement
- * @exception SQLException if a database access error occurs
- */
- public String nativeSQL(String sql) throws SQLException
- {
- return sql;
- }
-
- /*
- * The first warning reported by calls on this Connection is
- * returned.
- *
- * Note: Sebsequent warnings will be changed to this
- * SQLWarning
- *
- * @return the first SQLWarning or null
- * @exception SQLException if a database access error occurs
- */
- public SQLWarning getWarnings() throws SQLException
- {
- return firstWarning;
- }
-
- /*
- * After this call, getWarnings returns null until a new warning
- * is reported for this connection.
- *
- * @exception SQLException if a database access error occurs
- */
- public void clearWarnings() throws SQLException
- {
- firstWarning = null;
- }
-
-
- /*
- * You can put a connection in read-only mode as a hunt to enable
- * database optimizations
- *
- * Note: setReadOnly cannot be called while in the middle
- * of a transaction
- *
- * @param readOnly - true enables read-only mode; false disables it
- * @exception SQLException if a database access error occurs
- */
- public void setReadOnly(boolean readOnly) throws SQLException
- {
- this.readOnly = readOnly;
- }
-
- /*
- * 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 can by returning the value of the readOnly flag
- *
- * @return true if the connection is read only
- * @exception SQLException if a database access error occurs
- */
- public boolean isReadOnly() throws SQLException
- {
- return readOnly;
- }
-
- /*
- * If a connection is in auto-commit mode, than all its SQL
- * statements will be executed and committed as individual
- * transactions. Otherwise, its SQL statements are grouped
- * into transactions that are terminated by either commit()
- * or rollback(). By default, new connections are in auto-
- * commit mode. The commit occurs when the statement completes
- * or the next execute occurs, whichever comes first. In the
- * case of statements returning a ResultSet, the statement
- * completes when the last row of the ResultSet has been retrieved
- * or the ResultSet has been closed. In advanced cases, a single
- * statement may return multiple results as well as output parameter
- * values. Here the commit occurs when all results and output param
- * values have been retrieved.
- *
- * @param autoCommit - true enables auto-commit; false disables it
- * @exception SQLException if a database access error occurs
- */
- public void setAutoCommit(boolean autoCommit) throws SQLException
- {
- if (this.autoCommit == autoCommit)
- return;
- if (autoCommit)
- ExecSQL("end");
- else
- {
- if (haveMinimumServerVersion("7.1"))
- {
- ExecSQL("begin;" + getIsolationLevelSQL());
- }
- else
- {
- ExecSQL("begin");
- ExecSQL(getIsolationLevelSQL());
- }
- }
- this.autoCommit = autoCommit;
- }
-
- /*
- * gets the current auto-commit state
- *
- * @return Current state of the auto-commit mode
- * @exception SQLException (why?)
- * @see setAutoCommit
- */
- public boolean getAutoCommit() throws SQLException
- {
- return this.autoCommit;
- }
-
- /*
- * The method commit() makes all changes made since the previous
- * commit/rollback permanent and releases any database locks currently
- * held by the Connection. This method should only be used when
- * auto-commit has been disabled. (If autoCommit == true, then we
- * just return anyhow)
- *
- * @exception SQLException if a database access error occurs
- * @see setAutoCommit
- */
- public void commit() throws SQLException
- {
- if (autoCommit)
- return;
- if (haveMinimumServerVersion("7.1"))
- {
- ExecSQL("commit;begin;" + getIsolationLevelSQL());
- }
- else
- {
- ExecSQL("commit");
- ExecSQL("begin");
- ExecSQL(getIsolationLevelSQL());
- }
- }
-
- /*
- * The method rollback() drops all changes made since the previous
- * commit/rollback and releases any database locks currently held by
- * the Connection.
- *
- * @exception SQLException if a database access error occurs
- * @see commit
- */
- public void rollback() throws SQLException
- {
- if (autoCommit)
- return;
- if (haveMinimumServerVersion("7.1"))
- {
- ExecSQL("rollback; begin;" + getIsolationLevelSQL());
- }
- else
- {
- ExecSQL("rollback");
- ExecSQL("begin");
- ExecSQL(getIsolationLevelSQL());
- }
- }
-
- /*
- * Get this Connection's current transaction isolation mode.
- *
- * @return the current TRANSACTION_* mode value
- * @exception SQLException if a database access error occurs
- */
- public int getTransactionIsolation() throws SQLException
- {
- clearWarnings();
- ExecSQL("show transaction isolation level");
-
- SQLWarning warning = getWarnings();
- if (warning != null)
- {
- String message = warning.getMessage();
- clearWarnings();
- if (message.indexOf("READ COMMITTED") != -1)
- return java.sql.Connection.TRANSACTION_READ_COMMITTED;
- else if (message.indexOf("READ UNCOMMITTED") != -1)
- return java.sql.Connection.TRANSACTION_READ_UNCOMMITTED;
- else if (message.indexOf("REPEATABLE READ") != -1)
- return java.sql.Connection.TRANSACTION_REPEATABLE_READ;
- else if (message.indexOf("SERIALIZABLE") != -1)
- return java.sql.Connection.TRANSACTION_SERIALIZABLE;
- }
- return java.sql.Connection.TRANSACTION_READ_COMMITTED;
- }
-
- /*
- * You can call this method to try to change the transaction
- * isolation level using one of the TRANSACTION_* values.
- *
- * Note: setTransactionIsolation cannot be called while
- * in the middle of a transaction
- *
- * @param level one of the TRANSACTION_* isolation values with
- * the exception of TRANSACTION_NONE; some databases may
- * not support other values
- * @exception SQLException if a database access error occurs
- * @see java.sql.DatabaseMetaData#supportsTransactionIsolationLevel
- */
- public void setTransactionIsolation(int level) throws SQLException
- {
- //In 7.1 and later versions of the server it is possible using
- //the "set session" command to set this once for all future txns
- //however in 7.0 and prior versions it is necessary to set it in
- //each transaction, thus adding complexity below.
- //When we decide to drop support for servers older than 7.1
- //this can be simplified
- isolationLevel = level;
- String isolationLevelSQL;
-
- if (!haveMinimumServerVersion("7.1"))
- {
- isolationLevelSQL = getIsolationLevelSQL();
- }
- else
- {
- isolationLevelSQL = "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL ";
- switch (isolationLevel)
- {
- case java.sql.Connection.TRANSACTION_READ_COMMITTED:
- isolationLevelSQL += "READ COMMITTED";
- break;
- case java.sql.Connection.TRANSACTION_SERIALIZABLE:
- isolationLevelSQL += "SERIALIZABLE";
- break;
- default:
- throw new PSQLException("postgresql.con.isolevel",
- new Integer(isolationLevel));
- }
- }
- ExecSQL(isolationLevelSQL);
- }
-
- /*
- * Helper method used by setTransactionIsolation(), commit(), rollback()
- * and setAutoCommit(). This returns the SQL string needed to
- * set the isolation level for a transaction. In 7.1 and later it
- * is possible to set a default isolation level that applies to all
- * future transactions, this method is only necesary for 7.0 and older
- * servers, and should be removed when support for these older
- * servers are dropped
- */
- protected String getIsolationLevelSQL() throws SQLException
- {
- //7.1 and higher servers have a default specified so
- //no additional SQL is required to set the isolation level
- if (haveMinimumServerVersion("7.1"))
- {
- return "";
- }
- StringBuffer sb = new StringBuffer("SET TRANSACTION ISOLATION LEVEL");
-
- switch (isolationLevel)
- {
- case java.sql.Connection.TRANSACTION_READ_COMMITTED:
- sb.append(" READ COMMITTED");
- break;
-
- case java.sql.Connection.TRANSACTION_SERIALIZABLE:
- sb.append(" SERIALIZABLE");
- break;
-
- default:
- throw new PSQLException("postgresql.con.isolevel", new Integer(isolationLevel));
- }
- return sb.toString();
- }
-
- /*
- * A sub-space of this Connection's database may be selected by
- * setting a catalog name. If the driver does not support catalogs,
- * it will silently ignore this request
- *
- * @exception SQLException if a database access error occurs
- */
- public void setCatalog(String catalog) throws SQLException
- {
- //no-op
- }
-
- /*
- * Return the connections current catalog name, or null if no
- * catalog name is set, or we dont support catalogs.
- *
- * @return the current catalog name or null
- * @exception SQLException if a database access error occurs
- */
- public String getCatalog() throws SQLException
- {
- return PG_DATABASE;
- }
-
- /*
- * Overides finalize(). If called, it closes the connection.
- *
- * This was done at the request of Rachel Greenham
- * Only privileges matching the schema and table name
- * criteria are returned. They are ordered by TABLE_SCHEM,
- * TABLE_NAME, and PRIVILEGE.
- *
- * Each privilige description has the following columns:
- * Only privileges matching the schema and table name
+ * criteria are returned. They are ordered by TABLE_SCHEM,
+ * TABLE_NAME, and PRIVILEGE.
+ *
+ * Each privilige description has the following columns:
+ * This method will return the value of the given column as a
+ * Java object. The type of the Java object will be the default
+ * Java Object type corresponding to the column's SQL type, following
+ * the mapping specified in the JDBC specification.
+ *
+ * This method may also be used to read database specific abstract
+ * data types.
+ *
+ * @param columnIndex the first column is 1, the second is 2...
+ * @return a Object holding the column value
+ * @exception SQLException if a database access error occurs
+ */
+ public Object getObject(int columnIndex) throws SQLException
+ {
+ Field field;
+
+ checkResultSet( columnIndex );
+
+ wasNullFlag = (this_row[columnIndex - 1] == null);
+ if (wasNullFlag)
+ return null;
+
+ field = fields[columnIndex - 1];
+
+ // some fields can be null, mainly from those returned by MetaData methods
+ if (field == null)
+ {
+ wasNullFlag = true;
+ return null;
+ }
+
+ switch (field.getSQLType())
+ {
+ case Types.BIT:
+ return getBoolean(columnIndex) ? Boolean.TRUE : Boolean.FALSE;
+
+ case Types.SMALLINT:
+ return new Short(getShort(columnIndex));
+
+ case Types.INTEGER:
+ return new Integer(getInt(columnIndex));
+
+ case Types.BIGINT:
+ return new Long(getLong(columnIndex));
+
+ case Types.NUMERIC:
+ return getBigDecimal
+ (columnIndex, (field.getMod() == -1) ? -1 : ((field.getMod() - 4) & 0xffff));
+
+ case Types.REAL:
+ return new Float(getFloat(columnIndex));
+
+ case Types.DOUBLE:
+ return new Double(getDouble(columnIndex));
+
+ case Types.CHAR:
+ case Types.VARCHAR:
+ return getString(columnIndex);
+
+ case Types.DATE:
+ return getDate(columnIndex);
+
+ case Types.TIME:
+ return getTime(columnIndex);
+
+ case Types.TIMESTAMP:
+ return getTimestamp(columnIndex);
+
+ case Types.BINARY:
+ case Types.VARBINARY:
+ return getBytes(columnIndex);
+
+ case Types.ARRAY:
+ return getArray(columnIndex);
+
+ default:
+ String type = field.getPGType();
+ // if the backend doesn't know the type then coerce to String
+ if (type.equals("unknown"))
+ {
+ return getString(columnIndex);
+ }
+ else
+ {
+ return connection.getObject(field.getPGType(), getString(columnIndex));
+ }
+ }
+ }
+
+
+ public boolean absolute(int index) throws SQLException
+ {
+ // index is 1-based, but internally we use 0-based indices
+ int internalIndex;
+
+ if (index == 0)
+ throw new SQLException("Cannot move to index of 0");
+
+ final int rows_size = rows.size();
+
+ //if index<0, count from the end of the result set, but check
+ //to be sure that it is not beyond the first index
+ if (index < 0)
+ {
+ if (index >= -rows_size)
+ internalIndex = rows_size + index;
+ else
+ {
+ beforeFirst();
+ return false;
+ }
+ }
+ else
+ {
+ //must be the case that index>0,
+ //find the correct place, assuming that
+ //the index is not too large
+ if (index <= rows_size)
+ internalIndex = index - 1;
+ else
+ {
+ afterLast();
+ return false;
+ }
+ }
+
+ current_row = internalIndex;
+ this_row = (byte[][]) rows.elementAt(internalIndex);
+ return true;
+ }
+
+
+ public void afterLast() throws SQLException
+ {
+ final int rows_size = rows.size();
+ if (rows_size > 0)
+ current_row = rows_size;
+ }
+
+
+ public void beforeFirst() throws SQLException
+ {
+ if (rows.size() > 0)
+ current_row = -1;
+ }
+
+
+ public boolean first() throws SQLException
+ {
+ if (rows.size() <= 0)
+ return false;
+
+ onInsertRow = false;
+ current_row = 0;
+ this_row = (byte[][]) rows.elementAt(current_row);
+
+ rowBuffer = new byte[this_row.length][];
+ System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
+
+ return true;
+ }
+
+
+ public java.sql.Array getArray(String colName) throws SQLException
+ {
+ return getArray(findColumn(colName));
+ }
+
+
+ public java.sql.Array getArray(int i) throws SQLException
+ {
+ wasNullFlag = (this_row[i - 1] == null);
+ if (wasNullFlag)
+ return null;
+
+ if (i < 1 || i > fields.length)
+ throw new PSQLException("postgresql.res.colrange");
+ return (java.sql.Array) new org.postgresql.jdbc2.Array( connection, i, fields[i - 1], (java.sql.ResultSet) this );
+ }
+
+
+ public java.math.BigDecimal getBigDecimal(int columnIndex) throws SQLException
+ {
+ return getBigDecimal(columnIndex, -1);
+ }
+
+
+ public java.math.BigDecimal getBigDecimal(String columnName) throws SQLException
+ {
+ return getBigDecimal(findColumn(columnName));
+ }
+
+
+ public Blob getBlob(String columnName) throws SQLException
+ {
+ return getBlob(findColumn(columnName));
+ }
- //needed for updateable result set support
- protected boolean updateable = false;
- protected boolean doingUpdates = false;
- protected boolean onInsertRow = false;
- protected Hashtable updateValues = new Hashtable();
- private boolean usingOID = false; // are we using the OID for the primary key?
- private Vector primaryKeys; // list of primary keys
- private int numKeys = 0;
- private boolean singleTable = false;
- protected String tableName = null;
- protected PreparedStatement updateStatement = null;
- protected PreparedStatement insertStatement = null;
- protected PreparedStatement deleteStatement = null;
- private PreparedStatement selectStatement = null;
-
-
-
- public AbstractJdbc2ResultSet(org.postgresql.PGConnection conn, Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) {
- super (conn, statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
- }
-
- public java.net.URL getURL(int columnIndex) throws SQLException {
- return null;
- }
-
-
- public java.net.URL getURL(String columnName) throws SQLException {
- return null;
- }
-
-
- /*
- * Get the value of a column in the current row as a Java object
- *
- * This method will return the value of the given column as a
- * Java object. The type of the Java object will be the default
- * Java Object type corresponding to the column's SQL type, following
- * the mapping specified in the JDBC specification.
- *
- * This method may also be used to read database specific abstract
- * data types.
- *
- * @param columnIndex the first column is 1, the second is 2...
- * @return a Object holding the column value
- * @exception SQLException if a database access error occurs
- */
- public Object getObject(int columnIndex) throws SQLException {
- Field field;
-
- checkResultSet( columnIndex );
-
- wasNullFlag = (this_row[columnIndex - 1] == null);
- if (wasNullFlag)
- return null;
-
- field = fields[columnIndex - 1];
-
- // some fields can be null, mainly from those returned by MetaData methods
- if (field == null) {
- wasNullFlag = true;
- return null;
- }
-
- switch (field.getSQLType()) {
- case Types.BIT:
- return getBoolean(columnIndex) ? Boolean.TRUE : Boolean.FALSE;
-
- case Types.SMALLINT:
- return new Short(getShort(columnIndex));
-
- case Types.INTEGER:
- return new Integer(getInt(columnIndex));
-
- case Types.BIGINT:
- return new Long(getLong(columnIndex));
-
- case Types.NUMERIC:
- return getBigDecimal
- (columnIndex, (field.getMod() == -1) ? -1 : ((field.getMod() - 4) & 0xffff));
-
- case Types.REAL:
- return new Float(getFloat(columnIndex));
-
- case Types.DOUBLE:
- return new Double(getDouble(columnIndex));
-
- case Types.CHAR:
- case Types.VARCHAR:
- return getString(columnIndex);
-
- case Types.DATE:
- return getDate(columnIndex);
-
- case Types.TIME:
- return getTime(columnIndex);
-
- case Types.TIMESTAMP:
- return getTimestamp(columnIndex);
-
- case Types.BINARY:
- case Types.VARBINARY:
- return getBytes(columnIndex);
-
- case Types.ARRAY:
- return getArray(columnIndex);
- default:
- String type = field.getPGType();
- // if the backend doesn't know the type then coerce to String
- if (type.equals("unknown")) {
- return getString(columnIndex);
- }
- else {
- return connection.getObject(field.getPGType(), getString(columnIndex));
- }
- }
- }
+ public abstract Blob getBlob(int i) throws SQLException;
+
+
+ public java.io.Reader getCharacterStream(String columnName) throws SQLException
+ {
+ return getCharacterStream(findColumn(columnName));
+ }
+
+ public java.io.Reader getCharacterStream(int i) throws SQLException
+ {
+ checkResultSet( i );
+ wasNullFlag = (this_row[i - 1] == null);
+ if (wasNullFlag)
+ return null;
- public boolean absolute(int index) throws SQLException {
- // index is 1-based, but internally we use 0-based indices
- int internalIndex;
+ if (((AbstractJdbc2Connection) connection).haveMinimumCompatibleVersion("7.2"))
+ {
+ //Version 7.2 supports AsciiStream for all the PG text types
+ //As the spec/javadoc for this method indicate this is to be used for
+ //large text values (i.e. LONGVARCHAR) PG doesn't have a separate
+ //long string datatype, but with toast the text datatype is capable of
+ //handling very large values. Thus the implementation ends up calling
+ //getString() since there is no current way to stream the value from the server
+ return new CharArrayReader(getString(i).toCharArray());
+ }
+ else
+ {
+ // In 7.1 Handle as BLOBS so return the LargeObject input stream
+ Encoding encoding = connection.getEncoding();
+ InputStream input = getBinaryStream(i);
+ return encoding.getDecodingReader(input);
+ }
+ }
- if (index == 0)
- throw new SQLException("Cannot move to index of 0");
- final int rows_size = rows.size();
+ public Clob getClob(String columnName) throws SQLException
+ {
+ return getClob(findColumn(columnName));
+ }
- //if index<0, count from the end of the result set, but check
- //to be sure that it is not beyond the first index
- if (index < 0) {
- if (index >= -rows_size)
- internalIndex = rows_size + index;
- else {
- beforeFirst();
- return false;
- }
- }
- else {
- //must be the case that index>0,
- //find the correct place, assuming that
- //the index is not too large
- if (index <= rows_size)
- internalIndex = index - 1;
- else {
- afterLast();
- return false;
- }
- }
- current_row = internalIndex;
- this_row = (byte[][]) rows.elementAt(internalIndex);
- return true;
- }
+ public abstract Clob getClob(int i) throws SQLException;
- public void afterLast() throws SQLException {
- final int rows_size = rows.size();
- if (rows_size > 0)
- current_row = rows_size;
- }
+ public int getConcurrency() throws SQLException
+ {
+ if (statement == null)
+ return java.sql.ResultSet.CONCUR_READ_ONLY;
+ return statement.getResultSetConcurrency();
+ }
- public void beforeFirst() throws SQLException {
- if (rows.size() > 0)
- current_row = -1;
- }
+ public java.sql.Date getDate(int i, java.util.Calendar cal) throws SQLException
+ {
+ // If I read the specs, this should use cal only if we don't
+ // store the timezone, and if we do, then act just like getDate()?
+ // for now...
+ return getDate(i);
+ }
- public boolean first() throws SQLException
- {
- if (rows.size() <= 0)
- return false;
+ public Time getTime(int i, java.util.Calendar cal) throws SQLException
+ {
+ // If I read the specs, this should use cal only if we don't
+ // store the timezone, and if we do, then act just like getTime()?
+ // for now...
+ return getTime(i);
+ }
- onInsertRow = false;
- current_row = 0;
- this_row = (byte[][]) rows.elementAt(current_row);
- rowBuffer = new byte[this_row.length][];
- System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
+ public Timestamp getTimestamp(int i, java.util.Calendar cal) throws SQLException
+ {
+ // If I read the specs, this should use cal only if we don't
+ // store the timezone, and if we do, then act just like getDate()?
+ // for now...
+ return getTimestamp(i);
+ }
- return true;
- }
+ public java.sql.Date getDate(String c, java.util.Calendar cal) throws SQLException
+ {
+ return getDate(findColumn(c), cal);
+ }
- public java.sql.Array getArray(String colName) throws SQLException {
- return getArray(findColumn(colName));
- }
+ public Time getTime(String c, java.util.Calendar cal) throws SQLException
+ {
+ return getTime(findColumn(c), cal);
+ }
- public java.sql.Array getArray(int i) throws SQLException {
- wasNullFlag = (this_row[i - 1] == null);
- if (wasNullFlag)
- return null;
- if (i < 1 || i > fields.length)
- throw new PSQLException("postgresql.res.colrange");
- return (java.sql.Array) new org.postgresql.jdbc2.Array( connection, i, fields[i - 1], (java.sql.ResultSet) this );
- }
+ public Timestamp getTimestamp(String c, java.util.Calendar cal) throws SQLException
+ {
+ return getTimestamp(findColumn(c), cal);
+ }
- public java.math.BigDecimal getBigDecimal(int columnIndex) throws SQLException {
- return getBigDecimal(columnIndex, -1);
- }
+ public int getFetchDirection() throws SQLException
+ {
+ //PostgreSQL normally sends rows first->last
+ return java.sql.ResultSet.FETCH_FORWARD;
+ }
- public java.math.BigDecimal getBigDecimal(String columnName) throws SQLException {
- return getBigDecimal(findColumn(columnName));
- }
+ public int getFetchSize() throws SQLException
+ {
+ // In this implementation we return the entire result set, so
+ // here return the number of rows we have. Sub-classes can return a proper
+ // value
+ return rows.size();
+ }
- public Blob getBlob(String columnName) throws SQLException {
- return getBlob(findColumn(columnName));
- }
+ public Object getObject(String columnName, java.util.Map map) throws SQLException
+ {
+ return getObject(findColumn(columnName), map);
+ }
- public abstract Blob getBlob(int i) throws SQLException;
+ /*
+ * 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
+ * interface.
+ */
+ public Object getObject(int i, java.util.Map map) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- public java.io.Reader getCharacterStream(String columnName) throws SQLException {
- return getCharacterStream(findColumn(columnName));
- }
+ public Ref getRef(String columnName) throws SQLException
+ {
+ return getRef(findColumn(columnName));
+ }
- public java.io.Reader getCharacterStream(int i) throws SQLException {
- checkResultSet( i );
- wasNullFlag = (this_row[i - 1] == null);
- if (wasNullFlag)
- return null;
+ public Ref getRef(int i) throws SQLException
+ {
+ //The backend doesn't yet have SQL3 REF types
+ throw new PSQLException("postgresql.psqlnotimp");
+ }
- if (((AbstractJdbc2Connection) connection).haveMinimumCompatibleVersion("7.2")) {
- //Version 7.2 supports AsciiStream for all the PG text types
- //As the spec/javadoc for this method indicate this is to be used for
- //large text values (i.e. LONGVARCHAR) PG doesn't have a separate
- //long string datatype, but with toast the text datatype is capable of
- //handling very large values. Thus the implementation ends up calling
- //getString() since there is no current way to stream the value from the server
- return new CharArrayReader(getString(i).toCharArray());
- }
- else {
- // In 7.1 Handle as BLOBS so return the LargeObject input stream
- Encoding encoding = connection.getEncoding();
- InputStream input = getBinaryStream(i);
- return encoding.getDecodingReader(input);
- }
- }
+ public int getRow() throws SQLException
+ {
+ final int rows_size = rows.size();
- public Clob getClob(String columnName) throws SQLException {
- return getClob(findColumn(columnName));
- }
+ if (current_row < 0 || current_row >= rows_size)
+ return 0;
+ return current_row + 1;
+ }
- public abstract Clob getClob(int i) throws SQLException;
+ // This one needs some thought, as not all ResultSets come from a statement
+ public Statement getStatement() throws SQLException
+ {
+ return statement;
+ }
- public int getConcurrency() throws SQLException {
- if (statement == null)
- return java.sql.ResultSet.CONCUR_READ_ONLY;
- return statement.getResultSetConcurrency();
- }
+ public int getType() throws SQLException
+ {
+ // This implementation allows scrolling but is not able to
+ // see any changes. Sub-classes may overide this to return a more
+ // meaningful result.
+ return java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE;
+ }
- public java.sql.Date getDate(int i, java.util.Calendar cal) throws SQLException {
- // If I read the specs, this should use cal only if we don't
- // store the timezone, and if we do, then act just like getDate()?
- // for now...
- return getDate(i);
- }
+ public boolean isAfterLast() throws SQLException
+ {
+ final int rows_size = rows.size();
+ return (current_row >= rows_size && rows_size > 0);
+ }
- public Time getTime(int i, java.util.Calendar cal) throws SQLException {
- // If I read the specs, this should use cal only if we don't
- // store the timezone, and if we do, then act just like getTime()?
- // for now...
- return getTime(i);
- }
+ public boolean isBeforeFirst() throws SQLException
+ {
+ return (current_row < 0 && rows.size() > 0);
+ }
- public Timestamp getTimestamp(int i, java.util.Calendar cal) throws SQLException {
- // If I read the specs, this should use cal only if we don't
- // store the timezone, and if we do, then act just like getDate()?
- // for now...
- return getTimestamp(i);
- }
+ public boolean isFirst() throws SQLException
+ {
+ return (current_row == 0 && rows.size() >= 0);
+ }
- public java.sql.Date getDate(String c, java.util.Calendar cal) throws SQLException {
- return getDate(findColumn(c), cal);
- }
+ public boolean isLast() throws SQLException
+ {
+ final int rows_size = rows.size();
+ return (current_row == rows_size - 1 && rows_size > 0);
+ }
- public Time getTime(String c, java.util.Calendar cal) throws SQLException {
- return getTime(findColumn(c), cal);
- }
+ public boolean last() throws SQLException
+ {
+ final int rows_size = rows.size();
+ if (rows_size <= 0)
+ return false;
- public Timestamp getTimestamp(String c, java.util.Calendar cal) throws SQLException {
- return getTimestamp(findColumn(c), cal);
- }
+ current_row = rows_size - 1;
+ this_row = (byte[][]) rows.elementAt(current_row);
+ rowBuffer = new byte[this_row.length][];
+ System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
- public int getFetchDirection() throws SQLException {
- //PostgreSQL normally sends rows first->last
- return java.sql.ResultSet.FETCH_FORWARD;
- }
+ return true;
+ }
- public int getFetchSize() throws SQLException {
- // In this implementation we return the entire result set, so
- // here return the number of rows we have. Sub-classes can return a proper
- // value
- return rows.size();
- }
+ public boolean previous() throws SQLException
+ {
+ if (--current_row < 0)
+ return false;
+ this_row = (byte[][]) rows.elementAt(current_row);
+ System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
+ return true;
+ }
- public Object getObject(String columnName, java.util.Map map) throws SQLException {
- return getObject(findColumn(columnName), map);
- }
+ public boolean relative(int rows) throws SQLException
+ {
+ //have to add 1 since absolute expects a 1-based index
+ return absolute(current_row + 1 + rows);
+ }
- /*
- * 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
- * interface.
- */
- public Object getObject(int i, java.util.Map map) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ public void setFetchDirection(int direction) throws SQLException
+ {
+ throw new PSQLException("postgresql.psqlnotimp");
+ }
- public Ref getRef(String columnName) throws SQLException {
- return getRef(findColumn(columnName));
- }
+ public void setFetchSize(int rows) throws SQLException
+ {
+ // Sub-classes should implement this as part of their cursor support
+ throw org.postgresql.Driver.notImplemented();
+ }
- public Ref getRef(int i) throws SQLException {
- //The backend doesn't yet have SQL3 REF types
- throw new PSQLException("postgresql.psqlnotimp");
- }
+ public synchronized void cancelRowUpdates()
+ throws SQLException
+ {
+ if (doingUpdates)
+ {
+ doingUpdates = false;
+ clearRowBuffer();
+ }
+ }
- public int getRow() throws SQLException {
- final int rows_size = rows.size();
- if (current_row < 0 || current_row >= rows_size)
- return 0;
+ public synchronized void deleteRow()
+ throws SQLException
+ {
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- return current_row + 1;
- }
+ if (onInsertRow)
+ {
+ throw new PSQLException( "postgresql.updateable.oninsertrow" );
+ }
+ if (rows.size() == 0)
+ {
+ throw new PSQLException( "postgresql.updateable.emptydelete" );
+ }
+ if (isBeforeFirst())
+ {
+ throw new PSQLException( "postgresql.updateable.beforestartdelete" );
+ }
+ if (isAfterLast())
+ {
+ throw new PSQLException( "postgresql.updateable.afterlastdelete" );
+ }
- // This one needs some thought, as not all ResultSets come from a statement
- public Statement getStatement() throws SQLException {
- return statement;
- }
+ int numKeys = primaryKeys.size();
+ if ( deleteStatement == null )
+ {
- public int getType() throws SQLException {
- // This implementation allows scrolling but is not able to
- // see any changes. Sub-classes may overide this to return a more
- // meaningful result.
- return java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE;
- }
+ StringBuffer deleteSQL = new StringBuffer("DELETE FROM " ).append(tableName).append(" where " );
- public boolean isAfterLast() throws SQLException {
- final int rows_size = rows.size();
- return (current_row >= rows_size && rows_size > 0);
- }
+ for ( int i = 0; i < numKeys; i++ )
+ {
+ deleteSQL.append( ((PrimaryKey) primaryKeys.get(i)).name ).append( " = ? " );
+ if ( i < numKeys - 1 )
+ {
+ deleteSQL.append( " and " );
+ }
+ }
+ deleteStatement = ((java.sql.Connection) connection).prepareStatement(deleteSQL.toString());
+ }
+ deleteStatement.clearParameters();
- public boolean isBeforeFirst() throws SQLException {
- return (current_row < 0 && rows.size() > 0);
- }
+ for ( int i = 0; i < numKeys; i++ )
+ {
+ deleteStatement.setObject(i + 1, ((PrimaryKey) primaryKeys.get(i)).getValue());
+ }
- public boolean isFirst() throws SQLException {
- return (current_row == 0 && rows.size() >= 0);
- }
+ deleteStatement.executeUpdate();
+ rows.removeElementAt(current_row);
+ }
- public boolean isLast() throws SQLException {
- final int rows_size = rows.size();
- return (current_row == rows_size - 1 && rows_size > 0);
- }
+ public synchronized void insertRow()
+ throws SQLException
+ {
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- public boolean last() throws SQLException {
- final int rows_size = rows.size();
- if (rows_size <= 0)
- return false;
+ if (!onInsertRow)
+ {
+ throw new PSQLException( "postgresql.updateable.notoninsertrow" );
+ }
+ else
+ {
- current_row = rows_size - 1;
- this_row = (byte[][]) rows.elementAt(current_row);
+ // loop through the keys in the insertTable and create the sql statement
+ // we have to create the sql every time since the user could insert different
+ // columns each time
- rowBuffer = new byte[this_row.length][];
- System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
+ StringBuffer insertSQL = new StringBuffer("INSERT INTO ").append(tableName).append(" (");
+ StringBuffer paramSQL = new StringBuffer(") values (" );
- return true;
- }
+ Enumeration columnNames = updateValues.keys();
+ int numColumns = updateValues.size();
+ for ( int i = 0; columnNames.hasMoreElements(); i++ )
+ {
+ String columnName = (String) columnNames.nextElement();
- public boolean previous() throws SQLException {
- if (--current_row < 0)
- return false;
- this_row = (byte[][]) rows.elementAt(current_row);
- System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
- return true;
- }
+ insertSQL.append( columnName );
+ if ( i < numColumns - 1 )
+ {
+ insertSQL.append(", ");
+ paramSQL.append("?,");
+ }
+ else
+ {
+ paramSQL.append("?)");
+ }
+ }
- public boolean relative(int rows) throws SQLException {
- //have to add 1 since absolute expects a 1-based index
- return absolute(current_row + 1 + rows);
- }
+ insertSQL.append(paramSQL.toString());
+ insertStatement = ((java.sql.Connection) connection).prepareStatement(insertSQL.toString());
+ Enumeration keys = updateValues.keys();
- public void setFetchDirection(int direction) throws SQLException {
- throw new PSQLException("postgresql.psqlnotimp");
- }
+ for ( int i = 1; keys.hasMoreElements(); i++)
+ {
+ String key = (String) keys.nextElement();
+ insertStatement.setObject(i, updateValues.get( key ) );
+ }
+ insertStatement.executeUpdate();
- public void setFetchSize(int rows) throws SQLException {
- // Sub-classes should implement this as part of their cursor support
- throw org.postgresql.Driver.notImplemented();
- }
+ if ( usingOID )
+ {
+ // we have to get the last inserted OID and put it in the resultset
+ long insertedOID = ((AbstractJdbc2Statement) insertStatement).getLastOID();
- public synchronized void cancelRowUpdates() throws SQLException
- {
- if (doingUpdates)
- {
- doingUpdates = false;
+ updateValues.put("oid", new Long(insertedOID) );
- clearRowBuffer();
- }
- }
+ }
+ // update the underlying row to the new inserted data
+ updateRowBuffer();
- public synchronized void deleteRow() throws SQLException
- {
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ rows.addElement(rowBuffer);
- if (onInsertRow) {
- throw new PSQLException( "postgresql.updateable.oninsertrow" );
- }
+ // we should now reflect the current data in this_row
+ // that way getXXX will get the newly inserted data
+ this_row = rowBuffer;
- if (rows.size() == 0) {
- throw new PSQLException( "postgresql.updateable.emptydelete" );
- }
- if (isBeforeFirst()) {
- throw new PSQLException( "postgresql.updateable.beforestartdelete" );
- }
- if (isAfterLast()) {
- throw new PSQLException( "postgresql.updateable.afterlastdelete" );
- }
+ // need to clear this in case of another insert
+ clearRowBuffer();
- int numKeys = primaryKeys.size();
- if ( deleteStatement == null ) {
+ }
+ }
- StringBuffer deleteSQL = new StringBuffer("DELETE FROM " ).append(tableName).append(" where " );
+ public synchronized void moveToCurrentRow()
+ throws SQLException
+ {
+ if (!updateable)
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- for ( int i = 0; i < numKeys; i++ ) {
- deleteSQL.append( ((PrimaryKey) primaryKeys.get(i)).name ).append( " = ? " );
- if ( i < numKeys - 1 ) {
- deleteSQL.append( " and " );
- }
- }
+ this_row = (byte[][]) rows.elementAt(current_row);
- deleteStatement = ((java.sql.Connection) connection).prepareStatement(deleteSQL.toString());
- }
- deleteStatement.clearParameters();
+ rowBuffer = new byte[this_row.length][];
+ System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
- for ( int i = 0; i < numKeys; i++ ) {
- deleteStatement.setObject(i + 1, ((PrimaryKey) primaryKeys.get(i)).getValue());
- }
+ onInsertRow = false;
+ doingUpdates = false;
+ }
- deleteStatement.executeUpdate();
+ public synchronized void moveToInsertRow()
+ throws SQLException
+ {
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- rows.removeElementAt(current_row);
- }
+ if (insertStatement != null)
+ {
+ insertStatement = null;
+ }
- public synchronized void insertRow() throws SQLException {
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ // make sure the underlying data is null
+ clearRowBuffer();
- if (!onInsertRow) {
- throw new PSQLException( "postgresql.updateable.notoninsertrow" );
- }
- else {
+ onInsertRow = true;
+ doingUpdates = false;
- // loop through the keys in the insertTable and create the sql statement
- // we have to create the sql every time since the user could insert different
- // columns each time
+ }
- StringBuffer insertSQL = new StringBuffer("INSERT INTO ").append(tableName).append(" (");
- StringBuffer paramSQL = new StringBuffer(") values (" );
- Enumeration columnNames = updateValues.keys();
- int numColumns = updateValues.size();
+ private synchronized void clearRowBuffer()
+ throws SQLException
+ {
+ // rowBuffer is the temporary storage for the row
+ rowBuffer = new byte[fields.length][];
- for ( int i = 0; columnNames.hasMoreElements(); i++ ) {
- String columnName = (String) columnNames.nextElement();
+ // clear the updateValues hashTable for the next set of updates
+ updateValues.clear();
- insertSQL.append( columnName );
- if ( i < numColumns - 1 ) {
- insertSQL.append(", ");
- paramSQL.append("?,");
- }
- else {
- paramSQL.append("?)");
- }
+ }
- }
- insertSQL.append(paramSQL.toString());
- insertStatement = ((java.sql.Connection) connection).prepareStatement(insertSQL.toString());
+ public boolean rowDeleted() throws SQLException
+ {
+ // only sub-classes implement CONCURuPDATEABLE
+ throw Driver.notImplemented();
+ }
- Enumeration keys = updateValues.keys();
- for ( int i = 1; keys.hasMoreElements(); i++) {
- String key = (String) keys.nextElement();
- insertStatement.setObject(i, updateValues.get( key ) );
- }
+ public boolean rowInserted() throws SQLException
+ {
+ // only sub-classes implement CONCURuPDATEABLE
+ throw Driver.notImplemented();
+ }
- insertStatement.executeUpdate();
- if ( usingOID ) {
- // we have to get the last inserted OID and put it in the resultset
+ public boolean rowUpdated() throws SQLException
+ {
+ // only sub-classes implement CONCURuPDATEABLE
+ throw Driver.notImplemented();
+ }
- long insertedOID = ((AbstractJdbc2Statement) insertStatement).getLastOID();
- updateValues.put("oid", new Long(insertedOID) );
+ public synchronized void updateAsciiStream(int columnIndex,
+ java.io.InputStream x,
+ int length
+ )
+ throws SQLException
+ {
- }
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- // update the underlying row to the new inserted data
- updateRowBuffer();
+ byte[] theData = null;
- rows.addElement(rowBuffer);
+ try
+ {
+ x.read(theData, 0, length);
+ }
+ catch (NullPointerException ex )
+ {
+ throw new PSQLException("postgresql.updateable.inputstream");
+ }
+ catch (IOException ie)
+ {
+ throw new PSQLException("postgresql.updateable.ioerror" + ie);
+ }
- // we should now reflect the current data in this_row
- // that way getXXX will get the newly inserted data
- this_row = rowBuffer;
+ doingUpdates = !onInsertRow;
- // need to clear this in case of another insert
- clearRowBuffer();
+ updateValues.put( fields[columnIndex - 1].getName(), theData );
+ }
- }
- }
+ public synchronized void updateBigDecimal(int columnIndex,
+ java.math.BigDecimal x )
+ throws SQLException
+ {
- public synchronized void moveToCurrentRow() throws SQLException {
- if (!updateable) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- this_row = (byte[][]) rows.elementAt(current_row);
+ doingUpdates = !onInsertRow;
+ updateValues.put( fields[columnIndex - 1].getName(), x );
- rowBuffer = new byte[this_row.length][];
- System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
+ }
- onInsertRow = false;
- doingUpdates = false;
- }
+ public synchronized void updateBinaryStream(int columnIndex,
+ java.io.InputStream x,
+ int length
+ )
+ throws SQLException
+ {
- public synchronized void moveToInsertRow() throws SQLException
- {
- if ( !isUpdateable() )
- {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- if (insertStatement != null)
- {
- insertStatement = null;
- }
+ byte[] theData = null;
+ try
+ {
+ x.read(theData, 0, length);
- // make sure the underlying data is null
- clearRowBuffer();
+ }
+ catch ( NullPointerException ex )
+ {
+ throw new PSQLException("postgresql.updateable.inputstream");
+ }
+ catch (IOException ie)
+ {
+ throw new PSQLException("postgresql.updateable.ioerror" + ie);
+ }
- onInsertRow = true;
- doingUpdates = false;
+ doingUpdates = !onInsertRow;
- }
+ updateValues.put( fields[columnIndex - 1].getName(), theData );
+ }
- private synchronized void clearRowBuffer() throws SQLException
- {
- // rowBuffer is the temporary storage for the row
- rowBuffer = new byte[fields.length][];
- // clear the updateValues hashTable for the next set of updates
- updateValues.clear();
+ public synchronized void updateBoolean(int columnIndex, boolean x)
+ throws SQLException
+ {
- }
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
+ if ( Driver.logDebug )
+ Driver.debug("updating boolean " + fields[columnIndex - 1].getName() + "=" + x);
- public boolean rowDeleted() throws SQLException {
- // only sub-classes implement CONCURuPDATEABLE
- throw Driver.notImplemented();
- }
+ doingUpdates = !onInsertRow;
+ updateValues.put( fields[columnIndex - 1].getName(), new Boolean(x) );
+ }
- public boolean rowInserted() throws SQLException {
- // only sub-classes implement CONCURuPDATEABLE
- throw Driver.notImplemented();
- }
+ public synchronized void updateByte(int columnIndex, byte x)
+ throws SQLException
+ {
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- public boolean rowUpdated() throws SQLException {
- // only sub-classes implement CONCURuPDATEABLE
- throw Driver.notImplemented();
- }
+ doingUpdates = true;
+ updateValues.put( fields[columnIndex - 1].getName(), String.valueOf(x) );
+ }
- public synchronized void updateAsciiStream(int columnIndex,
- java.io.InputStream x,
- int length
- ) throws SQLException {
+ public synchronized void updateBytes(int columnIndex, byte[] x)
+ throws SQLException
+ {
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- byte[] theData = null;
+ doingUpdates = !onInsertRow;
+ updateValues.put( fields[columnIndex - 1].getName(), x );
- try {
- x.read(theData, 0, length);
- }
- catch (NullPointerException ex ) {
- throw new PSQLException("postgresql.updateable.inputstream");
- }
- catch (IOException ie) {
- throw new PSQLException("postgresql.updateable.ioerror" + ie);
- }
+ }
- doingUpdates = !onInsertRow;
- updateValues.put( fields[columnIndex - 1].getName(), theData );
+ public synchronized void updateCharacterStream(int columnIndex,
+ java.io.Reader x,
+ int length
+ )
+ throws SQLException
+ {
- }
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
+ char[] theData = null;
- public synchronized void updateBigDecimal(int columnIndex,
- java.math.BigDecimal x )
- throws SQLException {
+ try
+ {
+ x.read(theData, 0, length);
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ }
+ catch (NullPointerException ex)
+ {
+ throw new PSQLException("postgresql.updateable.inputstream");
+ }
+ catch (IOException ie)
+ {
+ throw new PSQLException("postgresql.updateable.ioerror" + ie);
+ }
- doingUpdates = !onInsertRow;
- updateValues.put( fields[columnIndex - 1].getName(), x );
+ doingUpdates = !onInsertRow;
+ updateValues.put( fields[columnIndex - 1].getName(), theData);
- }
+ }
- public synchronized void updateBinaryStream(int columnIndex,
- java.io.InputStream x,
- int length
- ) throws SQLException {
+ public synchronized void updateDate(int columnIndex, java.sql.Date x)
+ throws SQLException
+ {
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- byte[] theData = null;
+ doingUpdates = !onInsertRow;
+ updateValues.put( fields[columnIndex - 1].getName(), x );
+ }
- try {
- x.read(theData, 0, length);
- }
- catch ( NullPointerException ex ) {
- throw new PSQLException("postgresql.updateable.inputstream");
- }
- catch (IOException ie) {
- throw new PSQLException("postgresql.updateable.ioerror" + ie);
- }
+ public synchronized void updateDouble(int columnIndex, double x)
+ throws SQLException
+ {
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- doingUpdates = !onInsertRow;
+ if ( Driver.logDebug )
+ Driver.debug("updating double " + fields[columnIndex - 1].getName() + "=" + x);
- updateValues.put( fields[columnIndex - 1].getName(), theData );
+ doingUpdates = !onInsertRow;
+ updateValues.put( fields[columnIndex - 1].getName(), new Double(x) );
- }
+ }
- public synchronized void updateBoolean(int columnIndex, boolean x) throws SQLException {
+ public synchronized void updateFloat(int columnIndex, float x)
+ throws SQLException
+ {
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ if ( Driver.logDebug )
+ Driver.debug("updating float " + fields[columnIndex - 1].getName() + "=" + x);
- if ( Driver.logDebug ) Driver.debug("updating boolean " + fields[columnIndex - 1].getName() + "=" + x);
+ doingUpdates = !onInsertRow;
- doingUpdates = !onInsertRow;
- updateValues.put( fields[columnIndex - 1].getName(), new Boolean(x) );
+ updateValues.put( fields[columnIndex - 1].getName(), new Float(x) );
- }
+ }
- public synchronized void updateByte(int columnIndex, byte x) throws SQLException {
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ public synchronized void updateInt(int columnIndex, int x)
+ throws SQLException
+ {
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- doingUpdates = true;
- updateValues.put( fields[columnIndex - 1].getName(), String.valueOf(x) );
- }
+ if ( Driver.logDebug )
+ Driver.debug("updating int " + fields[columnIndex - 1].getName() + "=" + x);
+ doingUpdates = !onInsertRow;
+ updateValues.put( fields[columnIndex - 1].getName(), new Integer(x) );
- public synchronized void updateBytes(int columnIndex, byte[] x) throws SQLException {
+ }
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
- doingUpdates = !onInsertRow;
- updateValues.put( fields[columnIndex - 1].getName(), x );
+ public synchronized void updateLong(int columnIndex, long x)
+ throws SQLException
+ {
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- }
+ if ( Driver.logDebug )
+ Driver.debug("updating long " + fields[columnIndex - 1].getName() + "=" + x);
+ doingUpdates = !onInsertRow;
+ updateValues.put( fields[columnIndex - 1].getName(), new Long(x) );
- public synchronized void updateCharacterStream(int columnIndex,
- java.io.Reader x,
- int length
- ) throws SQLException {
+ }
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
- char[] theData = null;
+ public synchronized void updateNull(int columnIndex)
+ throws SQLException
+ {
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- try {
- x.read(theData, 0, length);
+ doingUpdates = !onInsertRow;
+ updateValues.put( fields[columnIndex - 1].getName(), null);
- }
- catch (NullPointerException ex) {
- throw new PSQLException("postgresql.updateable.inputstream");
- }
- catch (IOException ie) {
- throw new PSQLException("postgresql.updateable.ioerror" + ie);
- }
- doingUpdates = !onInsertRow;
- updateValues.put( fields[columnIndex - 1].getName(), theData);
+ }
- }
+ public synchronized void updateObject(int columnIndex, Object x)
+ throws SQLException
+ {
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- public synchronized void updateDate(int columnIndex, java.sql.Date x) throws SQLException {
+ if ( Driver.logDebug )
+ Driver.debug("updating object " + fields[columnIndex - 1].getName() + " = " + x);
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ doingUpdates = !onInsertRow;
+ updateValues.put( fields[columnIndex - 1].getName(), x );
+ }
- doingUpdates = !onInsertRow;
- updateValues.put( fields[columnIndex - 1].getName(), x );
- }
+ public synchronized void updateObject(int columnIndex, Object x, int scale)
+ throws SQLException
+ {
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
- public synchronized void updateDouble(int columnIndex, double x) throws SQLException {
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ this.updateObject(columnIndex, x);
- if ( Driver.logDebug ) Driver.debug("updating double " + fields[columnIndex - 1].getName() + "=" + x);
+ }
- doingUpdates = !onInsertRow;
- updateValues.put( fields[columnIndex - 1].getName(), new Double(x) );
- }
+ public void refreshRow() throws SQLException
+ {
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
+ try
+ {
+ StringBuffer selectSQL = new StringBuffer( "select ");
- public synchronized void updateFloat(int columnIndex, float x) throws SQLException {
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ final int numColumns = java.lang.reflect.Array.getLength(fields);
- if ( Driver.logDebug ) Driver.debug("updating float " + fields[columnIndex - 1].getName() + "=" + x);
+ for (int i = 0; i < numColumns; i++ )
+ {
- doingUpdates = !onInsertRow;
+ selectSQL.append( fields[i].getName() );
- updateValues.put( fields[columnIndex - 1].getName(), new Float(x) );
+ if ( i < numColumns - 1 )
+ {
- }
+ selectSQL.append(", ");
+ }
+ }
+ selectSQL.append(" from " ).append(tableName).append(" where ");
- public synchronized void updateInt(int columnIndex, int x) throws SQLException {
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ int numKeys = primaryKeys.size();
- if ( Driver.logDebug ) Driver.debug("updating int " + fields[columnIndex - 1].getName() + "=" + x);
+ for ( int i = 0; i < numKeys; i++ )
+ {
- doingUpdates = !onInsertRow;
- updateValues.put( fields[columnIndex - 1].getName(), new Integer(x) );
+ PrimaryKey primaryKey = ((PrimaryKey) primaryKeys.get(i));
+ selectSQL.append(primaryKey.name).append("= ?");
- }
+ if ( i < numKeys - 1 )
+ {
+ selectSQL.append(" and ");
+ }
+ }
+ if ( Driver.logDebug )
+ Driver.debug("selecting " + selectSQL.toString());
+ selectStatement = ((java.sql.Connection) connection).prepareStatement(selectSQL.toString());
- public synchronized void updateLong(int columnIndex, long x) throws SQLException {
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ for ( int j = 0, i = 1; j < numKeys; j++, i++)
+ {
+ selectStatement.setObject( i, ((PrimaryKey) primaryKeys.get(j)).getValue() );
+ }
- if ( Driver.logDebug ) Driver.debug("updating long " + fields[columnIndex - 1].getName() + "=" + x);
+ AbstractJdbc2ResultSet rs = (AbstractJdbc2ResultSet) selectStatement.executeQuery();
- doingUpdates = !onInsertRow;
- updateValues.put( fields[columnIndex - 1].getName(), new Long(x) );
+ if ( rs.first() )
+ {
+ rowBuffer = rs.rowBuffer;
+ }
- }
+ rows.setElementAt( rowBuffer, current_row );
+ if ( Driver.logDebug )
+ Driver.debug("done updates");
+ rs.close();
+ selectStatement.close();
+ selectStatement = null;
- public synchronized void updateNull(int columnIndex) throws SQLException {
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ }
+ catch (Exception e)
+ {
+ if ( Driver.logDebug )
+ Driver.debug(e.getClass().getName() + e);
+ throw new SQLException( e.getMessage() );
+ }
- doingUpdates = !onInsertRow;
- updateValues.put( fields[columnIndex - 1].getName(), null);
+ }
- }
+ public synchronized void updateRow()
+ throws SQLException
+ {
+ if ( !isUpdateable() )
+ {
+ throw new PSQLException( "postgresql.updateable.notupdateable" );
+ }
+ if (doingUpdates)
+ {
- public synchronized void updateObject(int columnIndex, Object x) throws SQLException {
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ try
+ {
- if ( Driver.logDebug ) Driver.debug("updating object " + fields[columnIndex - 1].getName() + " = " + x);
+ StringBuffer updateSQL = new StringBuffer("UPDATE " + tableName + " SET ");
- doingUpdates = !onInsertRow;
- updateValues.put( fields[columnIndex - 1].getName(), x );
- }
+ int numColumns = updateValues.size();
+ Enumeration columns = updateValues.keys();
+ for (int i = 0; columns.hasMoreElements(); i++ )
+ {
- public synchronized void updateObject(int columnIndex, Object x, int scale) throws SQLException {
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ String column = (String) columns.nextElement();
+ updateSQL.append( column + "= ?");
- this.updateObject(columnIndex, x);
+ if ( i < numColumns - 1 )
+ {
- }
+ updateSQL.append(", ");
+ }
+ }
+ updateSQL.append( " WHERE " );
- public void refreshRow() throws SQLException {
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ int numKeys = primaryKeys.size();
- try {
- StringBuffer selectSQL = new StringBuffer( "select ");
+ for ( int i = 0; i < numKeys; i++ )
+ {
- final int numColumns = java.lang.reflect.Array.getLength(fields);
+ PrimaryKey primaryKey = ((PrimaryKey) primaryKeys.get(i));
+ updateSQL.append(primaryKey.name).append("= ?");
- for (int i = 0; i < numColumns; i++ ) {
+ if ( i < numKeys - 1 )
+ {
+ updateSQL.append(" and ");
+ }
+ }
+ if ( Driver.logDebug )
+ Driver.debug("updating " + updateSQL.toString());
+ updateStatement = ((java.sql.Connection) connection).prepareStatement(updateSQL.toString());
- selectSQL.append( fields[i].getName() );
+ int i = 0;
+ Iterator iterator = updateValues.values().iterator();
+ for (; iterator.hasNext(); i++)
+ {
+ updateStatement.setObject( i + 1, iterator.next() );
- if ( i < numColumns - 1 ) {
+ }
+ for ( int j = 0; j < numKeys; j++, i++)
+ {
+ updateStatement.setObject( i + 1, ((PrimaryKey) primaryKeys.get(j)).getValue() );
+ }
- selectSQL.append(", ");
- }
+ updateStatement.executeUpdate();
+ updateStatement.close();
- }
- selectSQL.append(" from " ).append(tableName).append(" where ");
+ updateStatement = null;
+ updateRowBuffer();
- int numKeys = primaryKeys.size();
- for ( int i = 0; i < numKeys; i++ ) {
+ if ( Driver.logDebug )
+ Driver.debug("copying data");
+ System.arraycopy(rowBuffer, 0, this_row, 0, rowBuffer.length);
- PrimaryKey primaryKey = ((PrimaryKey) primaryKeys.get(i));
- selectSQL.append(primaryKey.name).append("= ?");
+ rows.setElementAt( rowBuffer, current_row );
+ if ( Driver.logDebug )
+ Driver.debug("done updates");
- if ( i < numKeys - 1 ) {
- selectSQL.append(" and ");
- }
- }
- if ( Driver.logDebug ) Driver.debug("selecting " + selectSQL.toString());
- selectStatement = ((java.sql.Connection) connection).prepareStatement(selectSQL.toString());
+ doingUpdates = false;
+ }
+ catch (Exception e)
+ {
+ if ( Driver.logDebug )
+ Driver.debug(e.getClass().getName() + e);
+ throw new SQLException( e.getMessage() );
+ }
+ }
- for ( int j = 0, i = 1; j < numKeys; j++, i++) {
- selectStatement.setObject( i, ((PrimaryKey) primaryKeys.get(j)).getValue() );
- }
+ }
- AbstractJdbc2ResultSet rs = (AbstractJdbc2ResultSet) selectStatement.executeQuery();
- if ( rs.first() ) {
- rowBuffer = rs.rowBuffer;
- }
+ public synchronized void updateShort(int columnIndex, short x)
+ throws SQLException
+ {
+ if ( Driver.logDebug )
+ Driver.debug("in update Short " + fields[columnIndex - 1].getName() + " = " + x);
- rows.setElementAt( rowBuffer, current_row );
- if ( Driver.logDebug ) Driver.debug("done updates");
- rs.close();
- selectStatement.close();
- selectStatement = null;
+ doingUpdates = !onInsertRow;
+ updateValues.put( fields[columnIndex - 1].getName(), new Short(x) );
- }
- catch (Exception e) {
- if ( Driver.logDebug ) Driver.debug(e.getClass().getName() + e);
- throw new SQLException( e.getMessage() );
- }
+ }
- }
+ public synchronized void updateString(int columnIndex, String x)
+ throws SQLException
+ {
+ if ( Driver.logDebug )
+ Driver.debug("in update String " + fields[columnIndex - 1].getName() + " = " + x);
- public synchronized void updateRow() throws SQLException {
- if ( !isUpdateable() ) {
- throw new PSQLException( "postgresql.updateable.notupdateable" );
- }
+ doingUpdates = !onInsertRow;
+ updateValues.put( fields[columnIndex - 1].getName(), x );
- if (doingUpdates) {
+ }
- try {
- StringBuffer updateSQL = new StringBuffer("UPDATE " + tableName + " SET ");
+ public synchronized void updateTime(int columnIndex, Time x)
+ throws SQLException
+ {
+ if ( Driver.logDebug )
+ Driver.debug("in update Time " + fields[columnIndex - 1].getName() + " = " + x);
- int numColumns = updateValues.size();
- Enumeration columns = updateValues.keys();
- for (int i = 0; columns.hasMoreElements(); i++ ) {
+ doingUpdates = !onInsertRow;
+ updateValues.put( fields[columnIndex - 1].getName(), x );
- String column = (String) columns.nextElement();
- updateSQL.append( column + "= ?");
+ }
- if ( i < numColumns - 1 ) {
- updateSQL.append(", ");
- }
+ public synchronized void updateTimestamp(int columnIndex, Timestamp x)
+ throws SQLException
+ {
+ if ( Driver.logDebug )
+ Driver.debug("updating Timestamp " + fields[columnIndex - 1].getName() + " = " + x);
- }
- updateSQL.append( " WHERE " );
+ doingUpdates = !onInsertRow;
+ updateValues.put( fields[columnIndex - 1].getName(), x );
- int numKeys = primaryKeys.size();
- for ( int i = 0; i < numKeys; i++ ) {
+ }
- PrimaryKey primaryKey = ((PrimaryKey) primaryKeys.get(i));
- updateSQL.append(primaryKey.name).append("= ?");
- if ( i < numKeys - 1 ) {
- updateSQL.append(" and ");
- }
- }
- if ( Driver.logDebug ) Driver.debug("updating " + updateSQL.toString());
- updateStatement = ((java.sql.Connection) connection).prepareStatement(updateSQL.toString());
+ public synchronized void updateNull(String columnName)
+ throws SQLException
+ {
+ updateNull(findColumn(columnName));
+ }
- int i = 0;
- Iterator iterator = updateValues.values().iterator();
- for (; iterator.hasNext(); i++) {
- updateStatement.setObject( i + 1, iterator.next() );
- }
- for ( int j = 0; j < numKeys; j++, i++) {
- updateStatement.setObject( i + 1, ((PrimaryKey) primaryKeys.get(j)).getValue() );
- }
+ public synchronized void updateBoolean(String columnName, boolean x)
+ throws SQLException
+ {
+ updateBoolean(findColumn(columnName), x);
+ }
- updateStatement.executeUpdate();
- updateStatement.close();
- updateStatement = null;
- updateRowBuffer();
+ public synchronized void updateByte(String columnName, byte x)
+ throws SQLException
+ {
+ updateByte(findColumn(columnName), x);
+ }
- if ( Driver.logDebug ) Driver.debug("copying data");
- System.arraycopy(rowBuffer, 0, this_row, 0, rowBuffer.length);
+ public synchronized void updateShort(String columnName, short x)
+ throws SQLException
+ {
+ updateShort(findColumn(columnName), x);
+ }
- rows.setElementAt( rowBuffer, current_row );
- if ( Driver.logDebug ) Driver.debug("done updates");
- doingUpdates = false;
- }
- catch (Exception e) {
- if ( Driver.logDebug ) Driver.debug(e.getClass().getName() + e);
- throw new SQLException( e.getMessage() );
- }
+ public synchronized void updateInt(String columnName, int x)
+ throws SQLException
+ {
+ updateInt(findColumn(columnName), x);
+ }
- }
- }
+ public synchronized void updateLong(String columnName, long x)
+ throws SQLException
+ {
+ updateLong(findColumn(columnName), x);
+ }
- public synchronized void updateShort(int columnIndex, short x) throws SQLException {
- if ( Driver.logDebug ) Driver.debug("in update Short " + fields[columnIndex - 1].getName() + " = " + x);
+ public synchronized void updateFloat(String columnName, float x)
+ throws SQLException
+ {
+ updateFloat(findColumn(columnName), x);
+ }
- doingUpdates = !onInsertRow;
- updateValues.put( fields[columnIndex - 1].getName(), new Short(x) );
+ public synchronized void updateDouble(String columnName, double x)
+ throws SQLException
+ {
+ updateDouble(findColumn(columnName), x);
+ }
- }
+ public synchronized void updateBigDecimal(String columnName, BigDecimal x)
+ throws SQLException
+ {
+ updateBigDecimal(findColumn(columnName), x);
+ }
- public synchronized void updateString(int columnIndex, String x) throws SQLException {
- if ( Driver.logDebug ) Driver.debug("in update String " + fields[columnIndex - 1].getName() + " = " + x);
- doingUpdates = !onInsertRow;
- updateValues.put( fields[columnIndex - 1].getName(), x );
+ public synchronized void updateString(String columnName, String x)
+ throws SQLException
+ {
+ updateString(findColumn(columnName), x);
+ }
- }
+ public synchronized void updateBytes(String columnName, byte x[])
+ throws SQLException
+ {
+ updateBytes(findColumn(columnName), x);
+ }
- public synchronized void updateTime(int columnIndex, Time x) throws SQLException {
- if ( Driver.logDebug ) Driver.debug("in update Time " + fields[columnIndex - 1].getName() + " = " + x);
+ public synchronized void updateDate(String columnName, java.sql.Date x)
+ throws SQLException
+ {
+ updateDate(findColumn(columnName), x);
+ }
- doingUpdates = !onInsertRow;
- updateValues.put( fields[columnIndex - 1].getName(), x );
- }
+ public synchronized void updateTime(String columnName, java.sql.Time x)
+ throws SQLException
+ {
+ updateTime(findColumn(columnName), x);
+ }
- public synchronized void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
- if ( Driver.logDebug ) Driver.debug("updating Timestamp " + fields[columnIndex - 1].getName() + " = " + x);
+ public synchronized void updateTimestamp(String columnName, java.sql.Timestamp x)
+ throws SQLException
+ {
+ updateTimestamp(findColumn(columnName), x);
+ }
- doingUpdates = !onInsertRow;
- updateValues.put( fields[columnIndex - 1].getName(), x );
+ public synchronized void updateAsciiStream(
+ String columnName,
+ java.io.InputStream x,
+ int length)
+ throws SQLException
+ {
+ updateAsciiStream(findColumn(columnName), x, length);
+ }
- }
+ public synchronized void updateBinaryStream(
+ String columnName,
+ java.io.InputStream x,
+ int length)
+ throws SQLException
+ {
+ updateBinaryStream(findColumn(columnName), x, length);
+ }
- public synchronized void updateNull(String columnName) throws SQLException {
- updateNull(findColumn(columnName));
- }
+ public synchronized void updateCharacterStream(
+ String columnName,
+ java.io.Reader reader,
+ int length)
+ throws SQLException
+ {
+ updateCharacterStream(findColumn(columnName), reader, length);
+ }
- public synchronized void updateBoolean(String columnName, boolean x) throws SQLException {
- updateBoolean(findColumn(columnName), x);
- }
+ public synchronized void updateObject(String columnName, Object x, int scale)
+ throws SQLException
+ {
+ updateObject(findColumn(columnName), x);
+ }
- public synchronized void updateByte(String columnName, byte x) throws SQLException {
- updateByte(findColumn(columnName), x);
- }
+ public synchronized void updateObject(String columnName, Object x)
+ throws SQLException
+ {
+ updateObject(findColumn(columnName), x);
+ }
- public synchronized void updateShort(String columnName, short x) throws SQLException {
- updateShort(findColumn(columnName), x);
- }
+ private int _findColumn( String columnName )
+ {
+ int i;
- public synchronized void updateInt(String columnName, int x) throws SQLException {
- updateInt(findColumn(columnName), x);
- }
+ final int flen = fields.length;
+ for (i = 0; i < flen; ++i)
+ {
+ if (fields[i].getName().equalsIgnoreCase(columnName))
+ {
+ return (i + 1);
+ }
+ }
+ return -1;
+ }
- public synchronized void updateLong(String columnName, long x) throws SQLException {
- updateLong(findColumn(columnName), x);
- }
+ /**
+ * Is this ResultSet updateable?
+ */
+ boolean isUpdateable() throws SQLException
+ {
- public synchronized void updateFloat(String columnName, float x) throws SQLException {
- updateFloat(findColumn(columnName), x);
- }
+ if (updateable)
+ return true;
+ if ( Driver.logDebug )
+ Driver.debug("checking if rs is updateable");
- public synchronized void updateDouble(String columnName, double x) throws SQLException {
- updateDouble(findColumn(columnName), x);
- }
+ parseQuery();
+ if ( singleTable == false )
+ {
+ if ( Driver.logDebug )
+ Driver.debug("not a single table");
+ return false;
+ }
- public synchronized void updateBigDecimal(String columnName, BigDecimal x)
- throws SQLException {
- updateBigDecimal(findColumn(columnName), x);
- }
+ if ( Driver.logDebug )
+ Driver.debug("getting primary keys");
+ //
+ // Contains the primary key?
+ //
- public synchronized void updateString(String columnName, String x) throws SQLException {
- updateString(findColumn(columnName), x);
- }
+ primaryKeys = new Vector();
+ // this is not stricty jdbc spec, but it will make things much faster if used
+ // the user has to select oid, * from table and then we will just use oid
- public synchronized void updateBytes(String columnName, byte x[]) throws SQLException {
- updateBytes(findColumn(columnName), x);
- }
+ usingOID = false;
+ int oidIndex = _findColumn( "oid" );
+ int i = 0;
- public synchronized void updateDate(String columnName, java.sql.Date x)
- throws SQLException {
- updateDate(findColumn(columnName), x);
- }
+ // if we find the oid then just use it
+
+ if ( oidIndex > 0 )
+ {
+ i++;
+ primaryKeys.add( new PrimaryKey( oidIndex, "oid" ) );
+ usingOID = true;
+ }
+ else
+ {
+ // otherwise go and get the primary keys and create a hashtable of keys
+ java.sql.ResultSet rs = ((java.sql.Connection) connection).getMetaData().getPrimaryKeys("", "", tableName);
+
+
+ for (; rs.next(); i++ )
+ {
+ String columnName = rs.getString(4); // get the columnName
+
+ int index = findColumn( columnName );
+
+ if ( index > 0 )
+ {
+ primaryKeys.add( new PrimaryKey(index, columnName ) ); // get the primary key information
+ }
+ }
+
+ rs.close();
+ }
+
+ numKeys = primaryKeys.size();
+
+ if ( Driver.logDebug )
+ Driver.debug( "no of keys=" + i );
- public synchronized void updateTime(String columnName, java.sql.Time x)
- throws SQLException {
- updateTime(findColumn(columnName), x);
- }
-
-
- public synchronized void updateTimestamp(String columnName, java.sql.Timestamp x)
- throws SQLException {
- updateTimestamp(findColumn(columnName), x);
- }
-
-
- public synchronized void updateAsciiStream(
- String columnName,
- java.io.InputStream x,
- int length)
- throws SQLException {
- updateAsciiStream(findColumn(columnName), x, length);
- }
-
-
- public synchronized void updateBinaryStream(
- String columnName,
- java.io.InputStream x,
- int length)
- throws SQLException {
- updateBinaryStream(findColumn(columnName), x, length);
- }
-
-
- public synchronized void updateCharacterStream(
- String columnName,
- java.io.Reader reader,
- int length)
- throws SQLException {
- updateCharacterStream(findColumn(columnName), reader, length);
- }
-
-
- public synchronized void updateObject(String columnName, Object x, int scale)
- throws SQLException {
- updateObject(findColumn(columnName), x);
- }
-
-
- public synchronized void updateObject(String columnName, Object x) throws SQLException {
- updateObject(findColumn(columnName), x);
- }
-
-
- private int _findColumn( String columnName ) {
- int i;
-
- final int flen = fields.length;
- for (i = 0; i < flen; ++i) {
- if (fields[i].getName().equalsIgnoreCase(columnName)) {
- return (i + 1);
- }
- }
- return -1;
- }
-
-
- /**
- * Is this ResultSet updateable?
- */
-
- boolean isUpdateable() throws SQLException
- {
-
- if (updateable) return true;
-
- if ( Driver.logDebug ) Driver.debug("checking if rs is updateable");
-
- parseQuery();
-
- if ( singleTable == false ) {
- if ( Driver.logDebug ) Driver.debug("not a single table");
- return false;
- }
-
- if ( Driver.logDebug ) Driver.debug("getting primary keys");
-
- //
- // Contains the primary key?
- //
-
- primaryKeys = new Vector();
-
- // this is not stricty jdbc spec, but it will make things much faster if used
- // the user has to select oid, * from table and then we will just use oid
-
-
- usingOID = false;
- int oidIndex = _findColumn( "oid" );
- int i = 0;
-
-
- // if we find the oid then just use it
-
- if ( oidIndex > 0 ) {
- i++;
- primaryKeys.add( new PrimaryKey( oidIndex, "oid" ) );
- usingOID = true;
- }
- else {
- // otherwise go and get the primary keys and create a hashtable of keys
- java.sql.ResultSet rs = ((java.sql.Connection) connection).getMetaData().getPrimaryKeys("", "", tableName);
-
-
- for (; rs.next(); i++ ) {
- String columnName = rs.getString(4); // get the columnName
-
- int index = findColumn( columnName );
-
- if ( index > 0 ) {
- primaryKeys.add( new PrimaryKey(index, columnName ) ); // get the primary key information
- }
- }
-
- rs.close();
- }
-
- numKeys = primaryKeys.size();
-
- if ( Driver.logDebug ) Driver.debug( "no of keys=" + i );
-
- if ( i < 1 ) {
- throw new SQLException("No Primary Keys");
- }
-
- updateable = primaryKeys.size() > 0;
-
- if ( Driver.logDebug ) Driver.debug( "checking primary key " + updateable );
-
- return updateable;
- }
-
-
- public void parseQuery() {
- String[] l_sqlFragments = ((AbstractJdbc2Statement)statement).getSqlFragments();
- String l_sql = l_sqlFragments[0];
- StringTokenizer st = new StringTokenizer(l_sql, " \r\t");
- boolean tableFound = false, tablesChecked = false;
- String name = "";
-
- singleTable = true;
-
- while ( !tableFound && !tablesChecked && st.hasMoreTokens() ) {
- name = st.nextToken();
- if ( !tableFound ) {
- if (name.toLowerCase().equals("from")) {
- tableName = st.nextToken();
- tableFound = true;
- }
- }
- else {
- tablesChecked = true;
- // if the very next token is , then there are multiple tables
- singleTable = !name.equalsIgnoreCase(",");
- }
- }
- }
-
-
- private void updateRowBuffer() throws SQLException {
-
- Enumeration columns = updateValues.keys();
-
- while ( columns.hasMoreElements() ) {
- String columnName = (String) columns.nextElement();
- int columnIndex = _findColumn( columnName ) - 1;
-
- switch ( connection.getSQLType( fields[columnIndex].getPGType() ) ) {
-
- case Types.DECIMAL:
- case Types.BIGINT:
- case Types.DOUBLE:
- case Types.BIT:
- case Types.VARCHAR:
- case Types.DATE:
- case Types.TIME:
- case Types.TIMESTAMP:
- case Types.SMALLINT:
- case Types.FLOAT:
- case Types.INTEGER:
- case Types.CHAR:
- case Types.NUMERIC:
- case Types.REAL:
- case Types.TINYINT:
-
- try {
- rowBuffer[columnIndex] = String.valueOf( updateValues.get( columnName ) ).getBytes(connection.getEncoding().name() );
- }
- catch ( UnsupportedEncodingException ex) {
- throw new SQLException("Unsupported Encoding " + connection.getEncoding().name());
- }
-
- case Types.NULL:
- continue;
-
- default:
- rowBuffer[columnIndex] = (byte[]) updateValues.get( columnName );
- }
-
- }
- }
-
-
- public void setStatement(Statement statement) {
- this.statement = statement;
- }
-
-
- private class PrimaryKey {
- int index; // where in the result set is this primaryKey
- String name; // what is the columnName of this primary Key
-
- PrimaryKey( int index, String name) {
- this.index = index;
- this.name = name;
- }
- Object getValue() throws SQLException {
- return getObject(index);
- }
- };
+ if ( i < 1 )
+ {
+ throw new SQLException("No Primary Keys");
+ }
+
+ updateable = primaryKeys.size() > 0;
+
+ if ( Driver.logDebug )
+ Driver.debug( "checking primary key " + updateable );
+
+ return updateable;
+ }
+
+
+ public void parseQuery()
+ {
+ String[] l_sqlFragments = ((AbstractJdbc2Statement)statement).getSqlFragments();
+ String l_sql = l_sqlFragments[0];
+ StringTokenizer st = new StringTokenizer(l_sql, " \r\t");
+ boolean tableFound = false, tablesChecked = false;
+ String name = "";
+
+ singleTable = true;
+
+ while ( !tableFound && !tablesChecked && st.hasMoreTokens() )
+ {
+ name = st.nextToken();
+ if ( !tableFound )
+ {
+ if (name.toLowerCase().equals("from"))
+ {
+ tableName = st.nextToken();
+ tableFound = true;
+ }
+ }
+ else
+ {
+ tablesChecked = true;
+ // if the very next token is , then there are multiple tables
+ singleTable = !name.equalsIgnoreCase(",");
+ }
+ }
+ }
+
+
+ private void updateRowBuffer() throws SQLException
+ {
+
+ Enumeration columns = updateValues.keys();
+
+ while ( columns.hasMoreElements() )
+ {
+ String columnName = (String) columns.nextElement();
+ int columnIndex = _findColumn( columnName ) - 1;
+
+ switch ( connection.getSQLType( fields[columnIndex].getPGType() ) )
+ {
+
+ case Types.DECIMAL:
+ case Types.BIGINT:
+ case Types.DOUBLE:
+ case Types.BIT:
+ case Types.VARCHAR:
+ case Types.DATE:
+ case Types.TIME:
+ case Types.TIMESTAMP:
+ case Types.SMALLINT:
+ case Types.FLOAT:
+ case Types.INTEGER:
+ case Types.CHAR:
+ case Types.NUMERIC:
+ case Types.REAL:
+ case Types.TINYINT:
+
+ try
+ {
+ rowBuffer[columnIndex] = String.valueOf( updateValues.get( columnName ) ).getBytes(connection.getEncoding().name() );
+ }
+ catch ( UnsupportedEncodingException ex)
+ {
+ throw new SQLException("Unsupported Encoding " + connection.getEncoding().name());
+ }
+
+ case Types.NULL:
+ continue;
+
+ default:
+ rowBuffer[columnIndex] = (byte[]) updateValues.get( columnName );
+ }
+
+ }
+ }
+
+
+ public void setStatement(Statement statement)
+ {
+ this.statement = statement;
+ }
+
+
+ private class PrimaryKey
+ {
+ int index; // where in the result set is this primaryKey
+ String name; // what is the columnName of this primary Key
+
+ PrimaryKey( int index, String name)
+ {
+ this.index = index;
+ this.name = name;
+ }
+ Object getValue() throws SQLException
+ {
+ return getObject(index);
+ }
+ };
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
index c64461607adca27dff0fd5a17faa06ac6c17ccb1..667af198a3072e2f540248dcb6fbd25f6887fc49 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
@@ -19,7 +19,7 @@ public abstract class AbstractJdbc2ResultSetMetaData extends org.postgresql.jdbc
*/
public AbstractJdbc2ResultSetMetaData(Vector rows, Field[] fields)
{
- super(rows, fields);
+ super(rows, fields);
}
/*
@@ -459,53 +459,53 @@ public abstract class AbstractJdbc2ResultSetMetaData extends org.postgresql.jdbc
// This can hook into our PG_Object mechanism
/**
- * Returns the fully-qualified name of the Java class whose instances
+ * Returns the fully-qualified name of the Java class whose instances
* are manufactured if the method This implementation supports JDK 1.3 and higher. According to the JDBC 2.0 Optional Package spec (6.2.3), only one
- * client may have an active handle to the connection at a time, so if
- * there is a previous handle active when this is called, the previous
- * one is forcibly closed and its work rolled back. According to the JDBC 2.0 Optional Package spec (6.2.3), only one
+ * client may have an active handle to the connection at a time, so if
+ * there is a previous handle active when this is called, the previous
+ * one is forcibly closed and its work rolled back. This implementation supports JDK 1.3 and higher.
- * This method should be used only when auto-commit has been disabled.
- *
- * @param savepoint the
- * This method is the same as the
+ * This method should be used only when auto-commit has been disabled.
+ *
+ * @param savepoint the
- * Note: This method is optimized for handling
- * parametric SQL statements that benefit from precompilation. If
- * the driver supports precompilation,
- * the method
- * Result sets created using the returned
- * An SQL statement with or without IN parameters can be
- * pre-compiled and stored in a
- * Note: This method is optimized for handling
- * parametric SQL statements that benefit from precompilation. If
- * the driver supports precompilation,
- * the method
- * Result sets created using the returned
+ * This method is the same as the
+ * Note: This method is optimized for handling
+ * parametric SQL statements that benefit from precompilation. If
+ * the driver supports precompilation,
+ * the method
+ * Result sets created using the returned
+ * An SQL statement with or without IN parameters can be
+ * pre-compiled and stored in a
+ * Note: This method is optimized for handling
+ * parametric SQL statements that benefit from precompilation. If
+ * the driver supports precompilation,
+ * the method
+ * Result sets created using the returned
+ * An SQL statement with or without IN parameters can be
+ * pre-compiled and stored in a
+ * Note: This method is optimized for handling
+ * parametric SQL statements that benefit from precompilation. If
+ * the driver supports precompilation,
+ * the method
+ * Result sets created using the returned
- * An SQL statement with or without IN parameters can be
- * pre-compiled and stored in a
- * Note: This method is optimized for handling
- * parametric SQL statements that benefit from precompilation. If
- * the driver supports precompilation,
- * the method
- * Result sets created using the returned
- * Only supertype information for UDTs matching the catalog,
- * schema, and type name is returned. The type name parameter
- * may be a fully-qualified name. When the UDT name supplied is a
- * fully-qualified name, the catalog and schemaPattern parameters are
- * ignored.
- *
- * If a UDT does not have a direct super type, it is not listed here.
- * A row of the Note: If the driver does not support type hierarchies, an
- * empty result set is returned.
- *
- * @param catalog a catalog name; "" retrieves those without a catalog;
- * Only supertable information for tables matching the catalog, schema
- * and table name are returned. The table name parameter may be a fully-
- * qualified name, in which case, the catalog and schemaPattern parameters
- * are ignored. If a table does not have a super table, it is not listed here.
- * Supertables have to be defined in the same catalog and schema as the
- * sub tables. Therefore, the type description does not need to include
- * this information for the supertable.
- *
- * Each type description has the following columns:
- * Note: If the driver does not support type hierarchies, an
- * empty result set is returned.
- *
- * @param catalog a catalog name; "" retrieves those without a catalog;
- *
+ * Only supertype information for UDTs matching the catalog,
+ * schema, and type name is returned. The type name parameter
+ * may be a fully-qualified name. When the UDT name supplied is a
+ * fully-qualified name, the catalog and schemaPattern parameters are
+ * ignored.
+ *
+ * If a UDT does not have a direct super type, it is not listed here.
+ * A row of the Note: If the driver does not support type hierarchies, an
+ * empty result set is returned.
+ *
+ * @param catalog a catalog name; "" retrieves those without a catalog;
+ *
- * Descriptions are returned only for attributes of UDTs matching the
- * catalog, schema, type, and attribute name criteria. They are ordered by
- * TYPE_SCHEM, TYPE_NAME and ORDINAL_POSITION. This description
- * does not contain inherited attributes.
- *
- * The Only supertable information for tables matching the catalog, schema
+ * and table name are returned. The table name parameter may be a fully-
+ * qualified name, in which case, the catalog and schemaPattern parameters
+ * are ignored. If a table does not have a super table, it is not listed here.
+ * Supertables have to be defined in the same catalog and schema as the
+ * sub tables. Therefore, the type description does not need to include
+ * this information for the supertable.
+ *
+ * Each type description has the following columns:
+ * Note: If the driver does not support type hierarchies, an
+ * empty result set is returned.
+ *
+ * @param catalog a catalog name; "" retrieves those without a catalog;
+ *
+ * Descriptions are returned only for attributes of UDTs matching the
+ * catalog, schema, type, and attribute name criteria. They are ordered by
+ * TYPE_SCHEM, TYPE_NAME and ORDINAL_POSITION. This description
+ * does not contain inherited attributes.
+ *
+ * The There are no more results when the following is true:
- *
- * In some (uncommon) situations, a single SQL statement may return
- * multiple result sets and/or update counts. Normally you can ignore
- * this unless you are (1) executing a stored procedure that you know may
- * return multiple results or (2) you are dynamically executing an
- * unknown SQL string.
- *
- * The
- * Under some (uncommon) situations, a single SQL statement may return
- * multiple result sets and/or update counts. Normally you can ignore
- * this unless you are (1) executing a stored procedure that you know may
- * return multiple results or (2) you are dynamically executing an
- * unknown SQL string.
- *
- * The
- * In some (uncommon) situations, a single SQL statement may return
- * multiple result sets and/or update counts. Normally you can ignore
- * this unless you are (1) executing a stored procedure that you know may
- * return multiple results or (2) you are dynamically executing an
- * unknown SQL string.
- *
- * The
- * The JDBC type specified by
- * If the JDBC type expected to be returned to this output parameter
- * is specific to this particular database,
- * The JDBC type specified by
- * This version of Note: When reading the value of an out parameter, you
- * must use the Note: You must specify the parameter's SQL type.
- *
- * @param parameterName the name of the parameter
- * @param sqlType the SQL type code defined in Note: This stream object can either be a standard
- * Java stream object or your own subclass that implements the
- * standard interface.
- *
- * @param parameterName the name of the parameter
- * @param x the Java input stream that contains the ASCII parameter value
- * @param length the number of bytes in the stream
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public void setAsciiStream(String parameterName, java.io.InputStream x, int length)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given input stream, which will have
- * the specified number of bytes.
- * When a very large binary value is input to a Note: This stream object can either be a standard
- * Java stream object or your own subclass that implements the
- * standard interface.
- *
- * @param parameterName the name of the parameter
- * @param x the java input stream which contains the binary parameter value
- * @param length the number of bytes in the stream
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public void setBinaryStream(String parameterName, java.io.InputStream x,
- int length) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the value of the designated parameter with the given object. The second
- * argument must be an object type; for integral values, the
- * The given Java object will be converted to the given targetSqlType
- * before being sent to the database.
- *
- * If the object has a custom mapping (is of a class implementing the
- * interface
- * Note that this method may be used to pass datatabase-
- * specific abstract data types.
- *
- * @param parameterName the name of the parameter
- * @param x the object containing the input parameter value
- * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
- * sent to the database. The scale argument may further qualify this type.
- * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
- * this is the number of digits after the decimal point. For all other
- * types, this value will be ignored.
- * @exception SQLException if a database access error occurs
- * @see Types
- * @see #getObject
- * @since 1.4
- */
- public void setObject(String parameterName, Object x, int targetSqlType, int scale)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the value of the designated parameter with the given object.
- * This method is like the method The JDBC specification specifies a standard mapping from
- * Java Note that this method may be used to pass datatabase-
- * specific abstract data types, by using a driver-specific Java
- * type.
- *
- * If the object is of a class implementing the interface
- * This method throws an exception if there is an ambiguity, for example, if the
- * object is of a class implementing more than one of the interfaces named above.
- *
- * @param parameterName the name of the parameter
- * @param x the object containing the input parameter value
- * @exception SQLException if a database access error occurs or if the given
- * Note: This stream object can either be a standard
- * Java stream object or your own subclass that implements the
- * standard interface.
- *
- * @param parameterName the name of the parameter
- * @param reader the Note: To be portable, applications must give the
- * SQL type code and the fully-qualified SQL type name when specifying
- * a NULL user-defined or REF parameter. In the case of a user-defined type
- * the name is the type name of the parameter itself. For a REF
- * parameter, the name is the type name of the referenced type. If
- * a JDBC driver does not need the type code or type name information,
- * it may ignore it.
- *
- * Although it is intended for user-defined and Ref parameters,
- * this method may be used to set a null parameter of any JDBC type.
- * If the parameter does not have a user-defined or REF type, the given
- * typeName is ignored.
- *
- *
- * @param paramName the name of the parameter
- * @param sqlType a value from
- * For the fixed-length type JDBC
- * This method returns a Java object whose type corresponds to the JDBC
- * type that was registered for this parameter using the method
- *
- * This method returns a Java object whose type corresponds to the
- * JDBC type that was registered for this parameter using the method
- * There are no more results when the following is true:
+ *
+ * In some (uncommon) situations, a single SQL statement may return
+ * multiple result sets and/or update counts. Normally you can ignore
+ * this unless you are (1) executing a stored procedure that you know may
+ * return multiple results or (2) you are dynamically executing an
+ * unknown SQL string.
+ *
+ * The
+ * Under some (uncommon) situations, a single SQL statement may return
+ * multiple result sets and/or update counts. Normally you can ignore
+ * this unless you are (1) executing a stored procedure that you know may
+ * return multiple results or (2) you are dynamically executing an
+ * unknown SQL string.
+ *
+ * The
+ * In some (uncommon) situations, a single SQL statement may return
+ * multiple result sets and/or update counts. Normally you can ignore
+ * this unless you are (1) executing a stored procedure that you know may
+ * return multiple results or (2) you are dynamically executing an
+ * unknown SQL string.
+ *
+ * The
+ * The JDBC type specified by
+ * If the JDBC type expected to be returned to this output parameter
+ * is specific to this particular database,
+ * The JDBC type specified by
+ * This version of Note: When reading the value of an out parameter, you
+ * must use the Note: You must specify the parameter's SQL type.
+ *
+ * @param parameterName the name of the parameter
+ * @param sqlType the SQL type code defined in Note: This stream object can either be a standard
+ * Java stream object or your own subclass that implements the
+ * standard interface.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the Java input stream that contains the ASCII parameter value
+ * @param length the number of bytes in the stream
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public void setAsciiStream(String parameterName, java.io.InputStream x, int length)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given input stream, which will have
+ * the specified number of bytes.
+ * When a very large binary value is input to a Note: This stream object can either be a standard
+ * Java stream object or your own subclass that implements the
+ * standard interface.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the java input stream which contains the binary parameter value
+ * @param length the number of bytes in the stream
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public void setBinaryStream(String parameterName, java.io.InputStream x,
+ int length) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the value of the designated parameter with the given object. The second
+ * argument must be an object type; for integral values, the
+ * The given Java object will be converted to the given targetSqlType
+ * before being sent to the database.
+ *
+ * If the object has a custom mapping (is of a class implementing the
+ * interface
+ * Note that this method may be used to pass datatabase-
+ * specific abstract data types.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the object containing the input parameter value
+ * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
+ * sent to the database. The scale argument may further qualify this type.
+ * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
+ * this is the number of digits after the decimal point. For all other
+ * types, this value will be ignored.
+ * @exception SQLException if a database access error occurs
+ * @see Types
+ * @see #getObject
+ * @since 1.4
+ */
+ public void setObject(String parameterName, Object x, int targetSqlType, int scale)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the value of the designated parameter with the given object.
+ * This method is like the method The JDBC specification specifies a standard mapping from
+ * Java Note that this method may be used to pass datatabase-
+ * specific abstract data types, by using a driver-specific Java
+ * type.
+ *
+ * If the object is of a class implementing the interface
+ * This method throws an exception if there is an ambiguity, for example, if the
+ * object is of a class implementing more than one of the interfaces named above.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the object containing the input parameter value
+ * @exception SQLException if a database access error occurs or if the given
+ * Note: This stream object can either be a standard
+ * Java stream object or your own subclass that implements the
+ * standard interface.
+ *
+ * @param parameterName the name of the parameter
+ * @param reader the Note: To be portable, applications must give the
+ * SQL type code and the fully-qualified SQL type name when specifying
+ * a NULL user-defined or REF parameter. In the case of a user-defined type
+ * the name is the type name of the parameter itself. For a REF
+ * parameter, the name is the type name of the referenced type. If
+ * a JDBC driver does not need the type code or type name information,
+ * it may ignore it.
+ *
+ * Although it is intended for user-defined and Ref parameters,
+ * this method may be used to set a null parameter of any JDBC type.
+ * If the parameter does not have a user-defined or REF type, the given
+ * typeName is ignored.
+ *
+ *
+ * @param paramName the name of the parameter
+ * @param sqlType a value from
+ * For the fixed-length type JDBC
+ * This method returns a Java object whose type corresponds to the JDBC
+ * type that was registered for this parameter using the method
+ *
+ * This method returns a Java object whose type corresponds to the
+ * JDBC type that was registered for this parameter using the method
+ *
- * This method was deprecated in 7.2 because the value of an OID
- * can be larger than a java signed int.
+ * This method was deprecated in 7.2 because the value of an OID
+ * can be larger than a java signed int.
* @deprecated Replaced by storeObject() in 7.2
*/
public int store(Object o) throws SQLException
{
- return (int) storeObject(o);
+ return (int) storeObject(o);
}
/*
@@ -296,7 +303,7 @@ public class Serialize
* @param o Object to store (must implement Serializable)
* @return oid of stored object
* @exception SQLException on error
- * @since 7.2
+ * @since 7.2
*/
public long storeObject(Object o) throws SQLException
{
@@ -389,7 +396,8 @@ public class Serialize
sb.append(')');
}
- if (Driver.logDebug) Driver.debug("Serialize.store: " + sb.toString() );
+ if (Driver.logDebug)
+ Driver.debug("Serialize.store: " + sb.toString() );
ResultSet rs = ((org.postgresql.jdbc1.AbstractJdbc1Connection)conn).ExecSQL(sb.toString());
// fetch the OID for returning
@@ -496,13 +504,15 @@ public class Serialize
ResultSet rs = ((org.postgresql.jdbc1.AbstractJdbc1Connection)con).ExecSQL("select relname from pg_class where relname = '" + tableName + "'");
if ( rs.next() )
{
- if (Driver.logDebug) Driver.debug("Serialize.create: table " + tableName + " exists, skipping");
+ if (Driver.logDebug)
+ Driver.debug("Serialize.create: table " + tableName + " exists, skipping");
rs.close();
- return;
+ return ;
}
// else table not found, so create it
- if (Driver.logDebug) Driver.debug("Serialize.create: table " + tableName + " not found, creating" );
+ if (Driver.logDebug)
+ Driver.debug("Serialize.create: table " + tableName + " not found, creating" );
// No entries returned, so the table doesn't exist
StringBuffer sb = new StringBuffer("create table ");
@@ -548,7 +558,8 @@ public class Serialize
sb.append(")");
// Now create the table
- if (Driver.logDebug) Driver.debug("Serialize.create: " + sb );
+ if (Driver.logDebug)
+ Driver.debug("Serialize.create: " + sb );
((org.postgresql.jdbc1.AbstractJdbc1Connection)con).ExecSQL(sb.toString());
}
+ * import org.postgresql.fastpath.*;
+ * ...
+ * Fastpath fp = ((org.postgresql.Connection)myconn).getFastpathAPI();
+ *
+ *
+ *
+ * import org.postgresql.largeobject.*;
+ * ...
+ * LargeObjectManager lo = ((org.postgresql.Connection)myconn).getLargeObjectAPI();
+ *
+ *
+ *
+ * ...
+ * ((org.postgresql.Connection)myconn).addDataType("mytype","my.class.name");
+ * ...
+ *
+ *
+ *
- * import org.postgresql.fastpath.*;
- * ...
- * Fastpath fp = ((org.postgresql.Connection)myconn).getFastpathAPI();
- *
- *
- *
- * import org.postgresql.largeobject.*;
- * ...
- * LargeObjectManager lo = ((org.postgresql.Connection)myconn).getLargeObjectAPI();
- *
- *
- *
- * ...
- * ((org.postgresql.Connection)myconn).addDataType("mytype","my.class.name");
- * ...
- *
- *
- *
- *
- *
- * @param catalog a catalog name; "" retrieves those without a catalog
- * @param schemaPattern a schema name pattern; "" retrieves those
- * without a schema
- * @param tableNamePattern a table name pattern
- * @return ResultSet each row is a table privilege description
- * @see #getSearchStringEscape
- */
- public java.sql.ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException
- {
- Field f[] = new Field[8];
- Vector v = new Vector();
-
- if (tableNamePattern == null)
- tableNamePattern = "%";
-
- f[0] = new Field(connection, "TABLE_CAT", iVarcharOid, 32);
- f[1] = new Field(connection, "TABLE_SCHEM", iVarcharOid, 32);
- f[2] = new Field(connection, "TABLE_NAME", iVarcharOid, 32);
- f[3] = new Field(connection, "COLUMN_NAME", iVarcharOid, 32);
- f[4] = new Field(connection, "GRANTOR", iVarcharOid, 32);
- f[5] = new Field(connection, "GRANTEE", iVarcharOid, 32);
- f[6] = new Field(connection, "PRIVILEGE", iVarcharOid, 32);
- f[7] = new Field(connection, "IS_GRANTABLE", iVarcharOid, 32);
-
- // This is taken direct from the psql source
- java.sql.ResultSet r = connection.ExecSQL("SELECT relname, relacl FROM pg_class, pg_user WHERE ( relkind = 'r' OR relkind = 'i') and relname !~ '^pg_' and relname !~ '^xin[vx][0-9]+' and usesysid = relowner and relname like '" + tableNamePattern.toLowerCase() + "' ORDER BY relname");
- while (r.next())
- {
- byte[][] tuple = new byte[8][0];
- tuple[0] = tuple[1] = "".getBytes();
- if (Driver.logDebug) Driver.debug("relname=\"" + r.getString(1) + "\" relacl=\"" + r.getString(2) + "\"");
-
- // For now, don't add to the result as relacl needs to be processed.
- //v.addElement(tuple);
- }
-
- return connection.getResultSet(null, f, v, "OK", 1);
- }
+ /*
+ * Get a description of the access rights for each table available
+ * in a catalog.
+ *
+ * This method is currently unimplemented.
+ *
+ *
+ *
+ *
+ * @param catalog a catalog name; "" retrieves those without a catalog
+ * @param schemaPattern a schema name pattern; "" retrieves those
+ * without a schema
+ * @param tableNamePattern a table name pattern
+ * @return ResultSet each row is a table privilege description
+ * @see #getSearchStringEscape
+ */
+ public java.sql.ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException
+ {
+ Field f[] = new Field[8];
+ Vector v = new Vector();
+
+ if (tableNamePattern == null)
+ tableNamePattern = "%";
+
+ f[0] = new Field(connection, "TABLE_CAT", iVarcharOid, 32);
+ f[1] = new Field(connection, "TABLE_SCHEM", iVarcharOid, 32);
+ f[2] = new Field(connection, "TABLE_NAME", iVarcharOid, 32);
+ f[3] = new Field(connection, "COLUMN_NAME", iVarcharOid, 32);
+ f[4] = new Field(connection, "GRANTOR", iVarcharOid, 32);
+ f[5] = new Field(connection, "GRANTEE", iVarcharOid, 32);
+ f[6] = new Field(connection, "PRIVILEGE", iVarcharOid, 32);
+ f[7] = new Field(connection, "IS_GRANTABLE", iVarcharOid, 32);
+
+ // This is taken direct from the psql source
+ java.sql.ResultSet r = connection.ExecSQL("SELECT relname, relacl FROM pg_class, pg_user WHERE ( relkind = 'r' OR relkind = 'i') and relname !~ '^pg_' and relname !~ '^xin[vx][0-9]+' and usesysid = relowner and relname like '" + tableNamePattern.toLowerCase() + "' ORDER BY relname");
+ while (r.next())
+ {
+ byte[][] tuple = new byte[8][0];
+ tuple[0] = tuple[1] = "".getBytes();
+ if (Driver.logDebug)
+ Driver.debug("relname=\"" + r.getString(1) + "\" relacl=\"" + r.getString(2) + "\"");
+
+ // For now, don't add to the result as relacl needs to be processed.
+ //v.addElement(tuple);
+ }
+
+ return connection.getResultSet(null, f, v, "OK", 1);
+ }
/*
* Get a description of a table's optimal set of columns that
@@ -2375,7 +2453,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
"a.attnum as KEY_SEQ," +
"ic.relname as PK_NAME " +
" FROM pg_class bc, pg_class ic, pg_index i, pg_attribute a" +
- " WHERE bc.relkind = 'r' " + // -- not indices
+ " WHERE bc.relkind = 'r' " + // -- not indices
" and upper(bc.relname) = upper('" + table + "')" +
" and i.indrelid = bc.oid" +
" and i.indexrelid = ic.oid" +
@@ -2385,274 +2463,275 @@ public abstract class AbstractJdbc1DatabaseMetaData
);
}
-/*
- SELECT
- c.relname as primary,
- c2.relname as foreign,
- t.tgconstrname,
- ic.relname as fkeyname,
- af.attnum as fkeyseq,
- ipc.relname as pkeyname,
- ap.attnum as pkeyseq,
- t.tgdeferrable,
- t.tginitdeferred,
- t.tgnargs,t.tgargs,
- p1.proname as updaterule,
- p2.proname as deleterule
-FROM
- pg_trigger t,
- pg_trigger t1,
- pg_class c,
- pg_class c2,
- pg_class ic,
- pg_class ipc,
- pg_proc p1,
- pg_proc p2,
- pg_index if,
- pg_index ip,
- pg_attribute af,
- pg_attribute ap
-WHERE
- (t.tgrelid=c.oid
- AND t.tgisconstraint
- AND t.tgconstrrelid=c2.oid
- AND t.tgfoid=p1.oid
- and p1.proname like '%%upd')
-
- and
- (t1.tgrelid=c.oid
- and t1.tgisconstraint
- and t1.tgconstrrelid=c2.oid
- AND t1.tgfoid=p2.oid
- and p2.proname like '%%del')
-
- AND c2.relname='users'
-
- AND
- (if.indrelid=c.oid
- AND if.indexrelid=ic.oid
- and ic.oid=af.attrelid
- AND if.indisprimary)
-
- and
- (ip.indrelid=c2.oid
- and ip.indexrelid=ipc.oid
- and ipc.oid=ap.attrelid
- and ip.indisprimary)
-
-*/
-/**
- *
- * @param catalog
- * @param schema
- * @param primaryTable if provided will get the keys exported by this table
- * @param foreignTable if provided will get the keys imported by this table
- * @return ResultSet
- * @throws SQLException
- */
-
- protected java.sql.ResultSet getImportedExportedKeys(String catalog, String schema, String primaryTable, String foreignTable) throws SQLException
- {
- Field f[] = new Field[14];
-
- f[0] = new Field(connection, "PKTABLE_CAT", iVarcharOid, 32);
- f[1] = new Field(connection, "PKTABLE_SCHEM", iVarcharOid, 32);
- f[2] = new Field(connection, "PKTABLE_NAME", iVarcharOid, 32);
- f[3] = new Field(connection, "PKCOLUMN_NAME", iVarcharOid, 32);
- f[4] = new Field(connection, "FKTABLE_CAT", iVarcharOid, 32);
- f[5] = new Field(connection, "FKTABLE_SCHEM", iVarcharOid, 32);
- f[6] = new Field(connection, "FKTABLE_NAME", iVarcharOid, 32);
- f[7] = new Field(connection, "FKCOLUMN_NAME", iVarcharOid, 32);
- f[8] = new Field(connection, "KEY_SEQ", iInt2Oid, 2);
- f[9] = new Field(connection, "UPDATE_RULE", iInt2Oid, 2);
- f[10] = new Field(connection, "DELETE_RULE", iInt2Oid, 2);
- f[11] = new Field(connection, "FK_NAME", iVarcharOid, 32);
- f[12] = new Field(connection, "PK_NAME", iVarcharOid, 32);
- f[13] = new Field(connection, "DEFERRABILITY", iInt2Oid, 2);
-
- java.sql.ResultSet rs = connection.ExecSQL(
- "SELECT distinct "
- + "c.relname as prelname, "
- + "c2.relname as frelname, "
- + "t.tgconstrname, "
- + "a.attnum as keyseq, "
- + "ic.relname as fkeyname, "
- + "t.tgdeferrable, "
- + "t.tginitdeferred, "
- + "t.tgnargs,t.tgargs, "
- + "p1.proname as updaterule, "
- + "p2.proname as deleterule "
- + "FROM "
- + "pg_trigger t, "
- + "pg_trigger t1, "
- + "pg_class c, "
- + "pg_class c2, "
- + "pg_class ic, "
- + "pg_proc p1, "
- + "pg_proc p2, "
- + "pg_index i, "
- + "pg_attribute a "
- + "WHERE "
- // isolate the update rule
- + "(t.tgrelid=c.oid "
- + "AND t.tgisconstraint "
- + "AND t.tgconstrrelid=c2.oid "
- + "AND t.tgfoid=p1.oid "
- + "and p1.proname like '%%upd') "
-
- + "and "
- // isolate the delete rule
- + "(t1.tgrelid=c.oid "
- + "and t1.tgisconstraint "
- + "and t1.tgconstrrelid=c2.oid "
- + "AND t1.tgfoid=p2.oid "
- + "and p2.proname like '%%del') "
-
- // if we are looking for exported keys then primary table will be used
- + ((primaryTable != null) ? "AND c.relname='" + primaryTable + "' " : "")
-
- // if we are looking for imported keys then the foreign table will be used
- + ((foreignTable != null) ? "AND c2.relname='" + foreignTable + "' " : "")
- + "AND i.indrelid=c.oid "
- + "AND i.indexrelid=ic.oid "
- + "AND ic.oid=a.attrelid "
- + "AND i.indisprimary "
- + "ORDER BY "
-
- // orderby is as follows getExported, orders by FKTABLE,
- // getImported orders by PKTABLE
- // getCrossReference orders by FKTABLE, so this should work for both,
- // since when getting crossreference, primaryTable will be defined
-
- + (primaryTable != null ? "frelname" : "prelname") + ",keyseq");
-
-// returns the following columns
-// and some example data with a table defined as follows
-
-// create table people ( id int primary key);
-// create table policy ( id int primary key);
-// create table users ( id int primary key, people_id int references people(id), policy_id int references policy(id))
-
-// prelname | frelname | tgconstrname | keyseq | fkeyName | tgdeferrable | tginitdeferred
-// 1 | 2 | 3 | 4 | 5 | 6 | 7
-
-// people | users | ResultSet.getObject
* is called to retrieve a value from the column.
- *
+ *
* ResultSet.getObject
may return a subclass of the class
* returned by this method.
*
* @param column the first column is 1, the second is 2, ...
* @return the fully-qualified name of the class in the Java programming
- * language that would be used by the method
- * ResultSet.getObject
to retrieve the value in the specified
- * column. This is the class name used for custom mapping.
+ * language that would be used by the method
+ * ResultSet.getObject
to retrieve the value in the specified
+ * column. This is the class name used for custom mapping.
* @exception SQLException if a database access error occurs
*/
public String getColumnClassName(int column) throws SQLException
{
- /*
- The following data type mapping came from ../Field.java.
-
- "int2",
- "int4","oid",
- "int8",
- "cash","money",
- "numeric",
- "float4",
- "float8",
- "bpchar","char","char2","char4","char8","char16",
- "varchar","text","name","filename",
- "bool",
- "date",
- "time",
- "abstime","timestamp"
-
- Types.SMALLINT,
- Types.INTEGER,Types.INTEGER,
- Types.BIGINT,
- Types.DOUBLE,Types.DOUBLE,
- Types.NUMERIC,
- Types.REAL,
- Types.DOUBLE,
- Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,
- Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,
- Types.BIT,
- Types.DATE,
- Types.TIME,
- Types.TIMESTAMP,Types.TIMESTAMP
- */
+ /*
+ The following data type mapping came from ../Field.java.
+
+ "int2",
+ "int4","oid",
+ "int8",
+ "cash","money",
+ "numeric",
+ "float4",
+ "float8",
+ "bpchar","char","char2","char4","char8","char16",
+ "varchar","text","name","filename",
+ "bool",
+ "date",
+ "time",
+ "abstime","timestamp"
+
+ Types.SMALLINT,
+ Types.INTEGER,Types.INTEGER,
+ Types.BIGINT,
+ Types.DOUBLE,Types.DOUBLE,
+ Types.NUMERIC,
+ Types.REAL,
+ Types.DOUBLE,
+ Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,
+ Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,
+ Types.BIT,
+ Types.DATE,
+ Types.TIME,
+ Types.TIMESTAMP,Types.TIMESTAMP
+ */
Field field = getField(column);
int sql_type = field.getSQLType();
@@ -513,40 +513,40 @@ public abstract class AbstractJdbc2ResultSetMetaData extends org.postgresql.jdbc
switch (sql_type)
{
case Types.BIT:
- return("java.lang.Boolean");
+ return ("java.lang.Boolean");
case Types.SMALLINT:
- return("java.lang.Short");
+ return ("java.lang.Short");
case Types.INTEGER:
- return("java.lang.Integer");
+ return ("java.lang.Integer");
case Types.BIGINT:
- return("java.lang.Long");
+ return ("java.lang.Long");
case Types.NUMERIC:
- return("java.math.BigDecimal");
+ return ("java.math.BigDecimal");
case Types.REAL:
- return("java.lang.Float");
+ return ("java.lang.Float");
case Types.DOUBLE:
- return("java.lang.Double");
+ return ("java.lang.Double");
case Types.CHAR:
case Types.VARCHAR:
- return("java.lang.String");
+ return ("java.lang.String");
case Types.DATE:
- return("java.sql.Date");
+ return ("java.sql.Date");
case Types.TIME:
- return("java.sql.Time");
+ return ("java.sql.Time");
case Types.TIMESTAMP:
- return("java.sql.Timestamp");
+ return ("java.sql.Timestamp");
case Types.BINARY:
case Types.VARBINARY:
- return("[B");
+ return ("[B");
case Types.ARRAY:
- return("java.sql.Array");
+ return ("java.sql.Array");
default:
String type = field.getPGType();
if ("unknown".equals(type))
{
- return("java.lang.String");
+ return ("java.lang.String");
}
- return("java.lang.Object");
+ return ("java.lang.Object");
}
}
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
index 3dd4e748bcf31eee0fea9381aabbdc4f16064076..7debda09ba82ad4bd96f50ab9aa5d574a85600b5 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
@@ -8,7 +8,7 @@ import java.util.Vector;
import org.postgresql.largeobject.*;
import org.postgresql.util.PSQLException;
-/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.5 2002/09/02 03:07:36 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.6 2002/09/06 21:23:06 momjian Exp $
* This class defines methods of the jdbc2 specification. This class extends
* org.postgresql.jdbc1.AbstractJdbc1Statement which provides the jdbc1
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Statement
@@ -45,8 +45,8 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
*/
public boolean execute() throws SQLException
{
- boolean l_return = super.execute();
- //Now do the jdbc2 specific stuff
+ boolean l_return = super.execute();
+ //Now do the jdbc2 specific stuff
//required for ResultSet.getStatement() to work and updateable resultsets
((AbstractJdbc2ResultSet)result).setStatement((Statement)this);
@@ -64,7 +64,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
public void clearBatch() throws SQLException
{
- batch = null;
+ batch = null;
}
public int[] executeBatch() throws SQLException
@@ -86,7 +86,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
PBatchUpdateException updex =
new PBatchUpdateException("postgresql.stat.batch.error",
- new Integer(i), batch.elementAt(i), resultSucceeded);
+ new Integer(i), batch.elementAt(i), resultSucceeded);
updex.setNextException(e);
throw updex;
@@ -183,12 +183,12 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
// is buffered internally anyhow, so there would be no performance
// boost gained, if anything it would be worse!
int bytesRemaining = (int)x.length();
- int numRead = l_inStream.read(buf,0,Math.min(buf.length,bytesRemaining));
+ int numRead = l_inStream.read(buf, 0, Math.min(buf.length, bytesRemaining));
while (numRead != -1 && bytesRemaining > 0)
{
- bytesRemaining -= numRead;
- los.write(buf,0,numRead);
- numRead = l_inStream.read(buf,0,Math.min(buf.length,bytesRemaining));
+ bytesRemaining -= numRead;
+ los.write(buf, 0, numRead);
+ numRead = l_inStream.read(buf, 0, Math.min(buf.length, bytesRemaining));
}
los.close();
}
@@ -384,9 +384,10 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
}
- //This is needed by AbstractJdbc2ResultSet to determine if the query is updateable or not
- protected String[] getSqlFragments() {
- return m_sqlFragments;
- }
+ //This is needed by AbstractJdbc2ResultSet to determine if the query is updateable or not
+ protected String[] getSqlFragments()
+ {
+ return m_sqlFragments;
+ }
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java
index 94cc5aab598efac4eaa385a96fc00767c55bd09e..cfaecc972b1741cb4248e8dc9a1a17784f6db7dc 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java
@@ -27,7 +27,7 @@ public class Array implements java.sql.Array
{
private org.postgresql.PGConnection conn = null;
private org.postgresql.Field field = null;
- private ResultSet rs;
+ private ResultSet rs;
private int idx = 0;
private String rawString = null;
@@ -44,7 +44,7 @@ public class Array implements java.sql.Array
{
this.conn = conn;
this.field = field;
- this.rs = rs;
+ this.rs = rs;
this.idx = idx;
this.rawString = ((AbstractJdbc2ResultSet)rs).getFixedString(idx);
}
@@ -76,9 +76,9 @@ public class Array implements java.sql.Array
ArrayList array = new ArrayList();
/* Check if the String is also not an empty array
- * otherwise there will be an exception thrown below
- * in the ResultSet.toX with an empty string.
- * -- Doug Fields BLOB
value that
- * this Blob
object represents, starting at position
- * pos
, and returns the number of bytes written.
- *
- * @param pos the position in the BLOB
object at which
- * to start writing
- * @param bytes the array of bytes to be written to the BLOB
- * value that this Blob
object represents
- * @return the number of bytes written
- * @exception SQLException if there is an error accessing the
- * BLOB
value
- * @see #getBytes
- * @since 1.4
- */
- public int setBytes(long pos, byte[] bytes) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Writes the given array of bytes to the BLOB
value that
+ * this Blob
object represents, starting at position
+ * pos
, and returns the number of bytes written.
+ *
+ * @param pos the position in the BLOB
object at which
+ * to start writing
+ * @param bytes the array of bytes to be written to the BLOB
+ * value that this Blob
object represents
+ * @return the number of bytes written
+ * @exception SQLException if there is an error accessing the
+ * BLOB
value
+ * @see #getBytes
+ * @since 1.4
+ */
+ public int setBytes(long pos, byte[] bytes) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Writes all or part of the given byte
array to the
- * BLOB
value that this Blob
object represents
- * and returns the number of bytes written.
- * Writing starts at position pos
in the BLOB
- * value; len
bytes from the given byte array are written.
- *
- * @param pos the position in the BLOB
object at which
- * to start writing
- * @param bytes the array of bytes to be written to this BLOB
- * object
- * @param offset the offset into the array bytes
at which
- * to start reading the bytes to be set
- * @param len the number of bytes to be written to the BLOB
- * value from the array of bytes bytes
- * @return the number of bytes written
- * @exception SQLException if there is an error accessing the
- * BLOB
value
- * @see #getBytes
- * @since 1.4
- */
- public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Writes all or part of the given byte
array to the
+ * BLOB
value that this Blob
object represents
+ * and returns the number of bytes written.
+ * Writing starts at position pos
in the BLOB
+ * value; len
bytes from the given byte array are written.
+ *
+ * @param pos the position in the BLOB
object at which
+ * to start writing
+ * @param bytes the array of bytes to be written to this BLOB
+ * object
+ * @param offset the offset into the array bytes
at which
+ * to start reading the bytes to be set
+ * @param len the number of bytes to be written to the BLOB
+ * value from the array of bytes bytes
+ * @return the number of bytes written
+ * @exception SQLException if there is an error accessing the
+ * BLOB
value
+ * @see #getBytes
+ * @since 1.4
+ */
+ public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves a stream that can be used to write to the BLOB
- * value that this Blob
object represents. The stream begins
- * at position pos
.
- *
- * @param pos the position in the BLOB
value at which
- * to start writing
- * @return a java.io.OutputStream
object to which data can
- * be written
- * @exception SQLException if there is an error accessing the
- * BLOB
value
- * @see #getBinaryStream
- * @since 1.4
- */
- public java.io.OutputStream setBinaryStream(long pos) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves a stream that can be used to write to the BLOB
+ * value that this Blob
object represents. The stream begins
+ * at position pos
.
+ *
+ * @param pos the position in the BLOB
value at which
+ * to start writing
+ * @return a java.io.OutputStream
object to which data can
+ * be written
+ * @exception SQLException if there is an error accessing the
+ * BLOB
value
+ * @see #getBinaryStream
+ * @since 1.4
+ */
+ public java.io.OutputStream setBinaryStream(long pos) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Truncates the BLOB
value that this Blob
- * object represents to be len
bytes in length.
- *
- * @param len the length, in bytes, to which the BLOB
value
- * that this Blob
object represents should be truncated
- * @exception SQLException if there is an error accessing the
- * BLOB
value
- * @since 1.4
- */
- public void truncate(long len) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Truncates the BLOB
value that this Blob
+ * object represents to be len
bytes in length.
+ *
+ * @param len the length, in bytes, to which the BLOB
value
+ * that this Blob
object represents should be truncated
+ * @exception SQLException if there is an error accessing the
+ * BLOB
value
+ * @since 1.4
+ */
+ public void truncate(long len) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Clob.java b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Clob.java
index 525530b537d3d3b0a61cf106df557ac2f17ecde2..fb2eb8ad965fdcd452eececf78fc340bc6bb449c 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Clob.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Clob.java
@@ -11,97 +11,102 @@ public abstract class AbstractJdbc3Clob extends org.postgresql.jdbc2.AbstractJdb
super(conn, oid);
}
- /**
- * Writes the given Java String
to the CLOB
- * value that this Clob
object designates at the position
- * pos
.
- *
- * @param pos the position at which to start writing to the CLOB
- * value that this Clob
object represents
- * @param str the string to be written to the CLOB
- * value that this Clob
designates
- * @return the number of characters written
- * @exception SQLException if there is an error accessing the
- * CLOB
value
- *
- * @since 1.4
- */
- public int setString(long pos, String str) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Writes the given Java String
to the CLOB
+ * value that this Clob
object designates at the position
+ * pos
.
+ *
+ * @param pos the position at which to start writing to the CLOB
+ * value that this Clob
object represents
+ * @param str the string to be written to the CLOB
+ * value that this Clob
designates
+ * @return the number of characters written
+ * @exception SQLException if there is an error accessing the
+ * CLOB
value
+ *
+ * @since 1.4
+ */
+ public int setString(long pos, String str) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Writes len
characters of str
, starting
- * at character offset
, to the CLOB
value
- * that this Clob
represents.
- *
- * @param pos the position at which to start writing to this
- * CLOB
object
- * @param str the string to be written to the CLOB
- * value that this Clob
object represents
- * @param offset the offset into str
to start reading
- * the characters to be written
- * @param len the number of characters to be written
- * @return the number of characters written
- * @exception SQLException if there is an error accessing the
- * CLOB
value
- *
- * @since 1.4
- */
- public int setString(long pos, String str, int offset, int len) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Writes len
characters of str
, starting
+ * at character offset
, to the CLOB
value
+ * that this Clob
represents.
+ *
+ * @param pos the position at which to start writing to this
+ * CLOB
object
+ * @param str the string to be written to the CLOB
+ * value that this Clob
object represents
+ * @param offset the offset into str
to start reading
+ * the characters to be written
+ * @param len the number of characters to be written
+ * @return the number of characters written
+ * @exception SQLException if there is an error accessing the
+ * CLOB
value
+ *
+ * @since 1.4
+ */
+ public int setString(long pos, String str, int offset, int len) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves a stream to be used to write Ascii characters to the
- * CLOB
value that this Clob
object represents,
- * starting at position pos
.
- *
- * @param pos the position at which to start writing to this
- * CLOB
object
- * @return the stream to which ASCII encoded characters can be written
- * @exception SQLException if there is an error accessing the
- * CLOB
value
- * @see #getAsciiStream
- *
- * @since 1.4
- */
- public java.io.OutputStream setAsciiStream(long pos) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves a stream to be used to write Ascii characters to the
+ * CLOB
value that this Clob
object represents,
+ * starting at position pos
.
+ *
+ * @param pos the position at which to start writing to this
+ * CLOB
object
+ * @return the stream to which ASCII encoded characters can be written
+ * @exception SQLException if there is an error accessing the
+ * CLOB
value
+ * @see #getAsciiStream
+ *
+ * @since 1.4
+ */
+ public java.io.OutputStream setAsciiStream(long pos) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves a stream to be used to write a stream of Unicode characters
- * to the CLOB
value that this Clob
object
- * represents, at position pos
.
- *
- * @param pos the position at which to start writing to the
- * CLOB
value
- *
- * @return a stream to which Unicode encoded characters can be written
- * @exception SQLException if there is an error accessing the
- * CLOB
value
- * @see #getCharacterStream
- *
- * @since 1.4
- */
- public java.io.Writer setCharacterStream(long pos) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves a stream to be used to write a stream of Unicode characters
+ * to the CLOB
value that this Clob
object
+ * represents, at position pos
.
+ *
+ * @param pos the position at which to start writing to the
+ * CLOB
value
+ *
+ * @return a stream to which Unicode encoded characters can be written
+ * @exception SQLException if there is an error accessing the
+ * CLOB
value
+ * @see #getCharacterStream
+ *
+ * @since 1.4
+ */
+ public java.io.Writer setCharacterStream(long pos) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Truncates the CLOB
value that this Clob
- * designates to have a length of len
- * characters.
- * @param len the length, in bytes, to which the CLOB
value
- * should be truncated
- * @exception SQLException if there is an error accessing the
- * CLOB
value
- *
- * @since 1.4
- */
- public void truncate(long len) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Truncates the CLOB
value that this Clob
+ * designates to have a length of len
+ * characters.
+ * @param len the length, in bytes, to which the CLOB
value
+ * should be truncated
+ * @exception SQLException if there is an error accessing the
+ * CLOB
value
+ *
+ * @since 1.4
+ */
+ public void truncate(long len) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Connection.java
index 5988eddb4db4756b62fac75b845b6db5ff1bc1f8..710d21557bc24de7d6b07927512955da3d75316a 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Connection.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Connection.java
@@ -2,7 +2,7 @@ package org.postgresql.jdbc3;
import java.sql.*;
-/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3Connection.java,v 1.1 2002/08/14 20:35:39 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3Connection.java,v 1.2 2002/09/06 21:23:06 momjian Exp $
* This class defines methods of the jdbc3 specification. This class extends
* org.postgresql.jdbc2.AbstractJdbc2Connection which provides the jdbc2
* methods. The real Connection class (for jdbc3) is org.postgresql.jdbc3.Jdbc3Connection
@@ -10,359 +10,371 @@ import java.sql.*;
public abstract class AbstractJdbc3Connection extends org.postgresql.jdbc2.AbstractJdbc2Connection
{
- /**
- * Changes the holdability of ResultSet
objects
- * created using this Connection
object to the given
- * holdability.
- *
- * @param holdability a ResultSet
holdability constant; one of
- * ResultSet.HOLD_CURSORS_OVER_COMMIT
or
- * ResultSet.CLOSE_CURSORS_AT_COMMIT
- * @throws SQLException if a database access occurs, the given parameter
- * is not a ResultSet
constant indicating holdability,
- * or the given holdability is not supported
- * @see #getHoldability
- * @see ResultSet
- * @since 1.4
- */
- public void setHoldability(int holdability) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Changes the holdability of ResultSet
objects
+ * created using this Connection
object to the given
+ * holdability.
+ *
+ * @param holdability a ResultSet
holdability constant; one of
+ * ResultSet.HOLD_CURSORS_OVER_COMMIT
or
+ * ResultSet.CLOSE_CURSORS_AT_COMMIT
+ * @throws SQLException if a database access occurs, the given parameter
+ * is not a ResultSet
constant indicating holdability,
+ * or the given holdability is not supported
+ * @see #getHoldability
+ * @see ResultSet
+ * @since 1.4
+ */
+ public void setHoldability(int holdability) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves the current holdability of ResultSet
objects
- * created using this Connection
object.
- *
- * @return the holdability, one of
- * ResultSet.HOLD_CURSORS_OVER_COMMIT
or
- * ResultSet.CLOSE_CURSORS_AT_COMMIT
- * @throws SQLException if a database access occurs
- * @see #setHoldability
- * @see ResultSet
- * @since 1.4
- */
- public int getHoldability() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Creates an unnamed savepoint in the current transaction and
- * returns the new Savepoint
object that represents it.
- *
- * @return the new Savepoint
object
- * @exception SQLException if a database access error occurs
- * or this Connection
object is currently in
- * auto-commit mode
- * @see Savepoint
- * @since 1.4
- */
- public Savepoint setSavepoint() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Creates a savepoint with the given name in the current transaction
- * and returns the new Savepoint
object that represents it.
- *
- * @param name a String
containing the name of the savepoint
- * @return the new Savepoint
object
- * @exception SQLException if a database access error occurs
- * or this Connection
object is currently in
- * auto-commit mode
- * @see Savepoint
- * @since 1.4
- */
- public Savepoint setSavepoint(String name) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Undoes all changes made after the given Savepoint
object
- * was set.
- * Savepoint
object to roll back to
- * @exception SQLException if a database access error occurs,
- * the Savepoint
object is no longer valid,
- * or this Connection
object is currently in
- * auto-commit mode
- * @see Savepoint
- * @see #rollback
- * @since 1.4
- */
- public void rollback(Savepoint savepoint) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
+ /**
+ * Retrieves the current holdability of ResultSet
objects
+ * created using this Connection
object.
+ *
+ * @return the holdability, one of
+ * ResultSet.HOLD_CURSORS_OVER_COMMIT
or
+ * ResultSet.CLOSE_CURSORS_AT_COMMIT
+ * @throws SQLException if a database access occurs
+ * @see #setHoldability
+ * @see ResultSet
+ * @since 1.4
+ */
+ public int getHoldability() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Removes the given Savepoint
object from the current
- * transaction. Any reference to the savepoint after it have been removed
- * will cause an SQLException
to be thrown.
- *
- * @param savepoint the Savepoint
object to be removed
- * @exception SQLException if a database access error occurs or
- * the given Savepoint
object is not a valid
- * savepoint in the current transaction
- * @since 1.4
- */
- public void releaseSavepoint(Savepoint savepoint) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
+ /**
+ * Creates an unnamed savepoint in the current transaction and
+ * returns the new Savepoint
object that represents it.
+ *
+ * @return the new Savepoint
object
+ * @exception SQLException if a database access error occurs
+ * or this Connection
object is currently in
+ * auto-commit mode
+ * @see Savepoint
+ * @since 1.4
+ */
+ public Savepoint setSavepoint() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Creates a Statement
object that will generate
- * ResultSet
objects with the given type, concurrency,
- * and holdability.
- * This method is the same as the createStatement
method
- * above, but it allows the default result set
- * type, concurrency, and holdability to be overridden.
- *
- * @param resultSetType one of the following ResultSet
- * constants:
- * ResultSet.TYPE_FORWARD_ONLY
,
- * ResultSet.TYPE_SCROLL_INSENSITIVE
, or
- * ResultSet.TYPE_SCROLL_SENSITIVE
- * @param resultSetConcurrency one of the following ResultSet
- * constants:
- * ResultSet.CONCUR_READ_ONLY
or
- * ResultSet.CONCUR_UPDATABLE
- * @param resultSetHoldability one of the following ResultSet
- * constants:
- * ResultSet.HOLD_CURSORS_OVER_COMMIT
or
- * ResultSet.CLOSE_CURSORS_AT_COMMIT
- * @return a new Statement
object that will generate
- * ResultSet
objects with the given type,
- * concurrency, and holdability
- * @exception SQLException if a database access error occurs
- * or the given parameters are not ResultSet
- * constants indicating type, concurrency, and holdability
- * @see ResultSet
- * @since 1.4
- */
- public Statement createStatement(int resultSetType, int resultSetConcurrency,
- int resultSetHoldability) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
+ /**
+ * Creates a savepoint with the given name in the current transaction
+ * and returns the new Savepoint
object that represents it.
+ *
+ * @param name a String
containing the name of the savepoint
+ * @return the new Savepoint
object
+ * @exception SQLException if a database access error occurs
+ * or this Connection
object is currently in
+ * auto-commit mode
+ * @see Savepoint
+ * @since 1.4
+ */
+ public Savepoint setSavepoint(String name) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Creates a PreparedStatement
object that will generate
- * ResultSet
objects with the given type, concurrency,
- * and holdability.
- * prepareStatement
method
- * above, but it allows the default result set
- * type, concurrency, and holdability to be overridden.
- *
- * @param sql a String
object that is the SQL statement to
- * be sent to the database; may contain one or more ? IN
- * parameters
- * @param resultSetType one of the following ResultSet
- * constants:
- * ResultSet.TYPE_FORWARD_ONLY
,
- * ResultSet.TYPE_SCROLL_INSENSITIVE
, or
- * ResultSet.TYPE_SCROLL_SENSITIVE
- * @param resultSetConcurrency one of the following ResultSet
- * constants:
- * ResultSet.CONCUR_READ_ONLY
or
- * ResultSet.CONCUR_UPDATABLE
- * @param resultSetHoldability one of the following ResultSet
- * constants:
- * ResultSet.HOLD_CURSORS_OVER_COMMIT
or
- * ResultSet.CLOSE_CURSORS_AT_COMMIT
- * @return a new PreparedStatement
object, containing the
- * pre-compiled SQL statement, that will generate
- * ResultSet
objects with the given type,
- * concurrency, and holdability
- * @exception SQLException if a database access error occurs
- * or the given parameters are not ResultSet
- * constants indicating type, concurrency, and holdability
- * @see ResultSet
- * @since 1.4
- */
- public PreparedStatement prepareStatement(String sql, int resultSetType,
- int resultSetConcurrency, int resultSetHoldability)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
+ /**
+ * Undoes all changes made after the given Savepoint
object
+ * was set.
+ * Savepoint
object to roll back to
+ * @exception SQLException if a database access error occurs,
+ * the Savepoint
object is no longer valid,
+ * or this Connection
object is currently in
+ * auto-commit mode
+ * @see Savepoint
+ * @see #rollback
+ * @since 1.4
+ */
+ public void rollback(Savepoint savepoint) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Creates a CallableStatement
object that will generate
- * ResultSet
objects with the given type and concurrency.
- * This method is the same as the prepareCall
method
- * above, but it allows the default result set
- * type, result set concurrency type and holdability to be overridden.
- *
- * @param sql a String
object that is the SQL statement to
- * be sent to the database; may contain on or more ? parameters
- * @param resultSetType one of the following ResultSet
- * constants:
- * ResultSet.TYPE_FORWARD_ONLY
,
- * ResultSet.TYPE_SCROLL_INSENSITIVE
, or
- * ResultSet.TYPE_SCROLL_SENSITIVE
- * @param resultSetConcurrency one of the following ResultSet
- * constants:
- * ResultSet.CONCUR_READ_ONLY
or
- * ResultSet.CONCUR_UPDATABLE
- * @param resultSetHoldability one of the following ResultSet
- * constants:
- * ResultSet.HOLD_CURSORS_OVER_COMMIT
or
- * ResultSet.CLOSE_CURSORS_AT_COMMIT
- * @return a new CallableStatement
object, containing the
- * pre-compiled SQL statement, that will generate
- * ResultSet
objects with the given type,
- * concurrency, and holdability
- * @exception SQLException if a database access error occurs
- * or the given parameters are not ResultSet
- * constants indicating type, concurrency, and holdability
- * @see ResultSet
- * @since 1.4
- */
- public CallableStatement prepareCall(String sql, int resultSetType,
- int resultSetConcurrency,
- int resultSetHoldability) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
+ /**
+ * Removes the given Savepoint
object from the current
+ * transaction. Any reference to the savepoint after it have been removed
+ * will cause an SQLException
to be thrown.
+ *
+ * @param savepoint the Savepoint
object to be removed
+ * @exception SQLException if a database access error occurs or
+ * the given Savepoint
object is not a valid
+ * savepoint in the current transaction
+ * @since 1.4
+ */
+ public void releaseSavepoint(Savepoint savepoint) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Creates a default PreparedStatement
object that has
- * the capability to retrieve auto-generated keys. The given constant
- * tells the driver whether it should make auto-generated keys
- * available for retrieval. This parameter is ignored if the SQL
- * statement is not an INSERT
statement.
- * prepareStatement
will send
- * the statement to the database for precompilation. Some drivers
- * may not support precompilation. In this case, the statement may
- * not be sent to the database until the PreparedStatement
- * object is executed. This has no direct effect on users; however, it does
- * affect which methods throw certain SQLExceptions.
- * PreparedStatement
- * object will by default be type TYPE_FORWARD_ONLY
- * and have a concurrency level of CONCUR_READ_ONLY
.
- *
- * @param sql an SQL statement that may contain one or more '?' IN
- * parameter placeholders
- * @param autoGeneratedKeys a flag indicating whether auto-generated keys
- * should be returned; one of the following Statement
- * constants:
- * @param autoGeneratedKeys a flag indicating that auto-generated keys should be returned, one of
- * Statement.RETURN_GENERATED_KEYS
or
- * Statement.NO_GENERATED_KEYS
.
- * @return a new PreparedStatement
object, containing the
- * pre-compiled SQL statement, that will have the capability of
- * returning auto-generated keys
- * @exception SQLException if a database access error occurs
- * or the given parameter is not a Statement
- * constant indicating whether auto-generated keys should be
- * returned
- * @since 1.4
- */
- public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Creates a default PreparedStatement
object capable
- * of returning the auto-generated keys designated by the given array.
- * This array contains the indexes of the columns in the target
- * table that contain the auto-generated keys that should be made
- * available. This array is ignored if the SQL
- * statement is not an INSERT
statement.
- * PreparedStatement
object. This
- * object can then be used to efficiently execute this statement
- * multiple times.
- * prepareStatement
will send
- * the statement to the database for precompilation. Some drivers
- * may not support precompilation. In this case, the statement may
- * not be sent to the database until the PreparedStatement
- * object is executed. This has no direct effect on users; however, it does
- * affect which methods throw certain SQLExceptions.
- * PreparedStatement
- * object will by default be type TYPE_FORWARD_ONLY
- * and have a concurrency level of CONCUR_READ_ONLY
.
- *
- * @param sql an SQL statement that may contain one or more '?' IN
- * parameter placeholders
- * @param columnIndexes an array of column indexes indicating the columns
- * that should be returned from the inserted row or rows
- * @return a new PreparedStatement
object, containing the
- * pre-compiled statement, that is capable of returning the
- * auto-generated keys designated by the given array of column
- * indexes
- * @exception SQLException if a database access error occurs
- *
- * @since 1.4
- */
- public PreparedStatement prepareStatement(String sql, int columnIndexes[])
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
+ /**
+ * Creates a Statement
object that will generate
+ * ResultSet
objects with the given type, concurrency,
+ * and holdability.
+ * This method is the same as the createStatement
method
+ * above, but it allows the default result set
+ * type, concurrency, and holdability to be overridden.
+ *
+ * @param resultSetType one of the following ResultSet
+ * constants:
+ * ResultSet.TYPE_FORWARD_ONLY
,
+ * ResultSet.TYPE_SCROLL_INSENSITIVE
, or
+ * ResultSet.TYPE_SCROLL_SENSITIVE
+ * @param resultSetConcurrency one of the following ResultSet
+ * constants:
+ * ResultSet.CONCUR_READ_ONLY
or
+ * ResultSet.CONCUR_UPDATABLE
+ * @param resultSetHoldability one of the following ResultSet
+ * constants:
+ * ResultSet.HOLD_CURSORS_OVER_COMMIT
or
+ * ResultSet.CLOSE_CURSORS_AT_COMMIT
+ * @return a new Statement
object that will generate
+ * ResultSet
objects with the given type,
+ * concurrency, and holdability
+ * @exception SQLException if a database access error occurs
+ * or the given parameters are not ResultSet
+ * constants indicating type, concurrency, and holdability
+ * @see ResultSet
+ * @since 1.4
+ */
+ public Statement createStatement(int resultSetType, int resultSetConcurrency,
+ int resultSetHoldability) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+
+ /**
+ * Creates a PreparedStatement
object that will generate
+ * ResultSet
objects with the given type, concurrency,
+ * and holdability.
+ * prepareStatement
method
+ * above, but it allows the default result set
+ * type, concurrency, and holdability to be overridden.
+ *
+ * @param sql a String
object that is the SQL statement to
+ * be sent to the database; may contain one or more ? IN
+ * parameters
+ * @param resultSetType one of the following ResultSet
+ * constants:
+ * ResultSet.TYPE_FORWARD_ONLY
,
+ * ResultSet.TYPE_SCROLL_INSENSITIVE
, or
+ * ResultSet.TYPE_SCROLL_SENSITIVE
+ * @param resultSetConcurrency one of the following ResultSet
+ * constants:
+ * ResultSet.CONCUR_READ_ONLY
or
+ * ResultSet.CONCUR_UPDATABLE
+ * @param resultSetHoldability one of the following ResultSet
+ * constants:
+ * ResultSet.HOLD_CURSORS_OVER_COMMIT
or
+ * ResultSet.CLOSE_CURSORS_AT_COMMIT
+ * @return a new PreparedStatement
object, containing the
+ * pre-compiled SQL statement, that will generate
+ * ResultSet
objects with the given type,
+ * concurrency, and holdability
+ * @exception SQLException if a database access error occurs
+ * or the given parameters are not ResultSet
+ * constants indicating type, concurrency, and holdability
+ * @see ResultSet
+ * @since 1.4
+ */
+ public PreparedStatement prepareStatement(String sql, int resultSetType,
+ int resultSetConcurrency, int resultSetHoldability)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+
+ /**
+ * Creates a CallableStatement
object that will generate
+ * ResultSet
objects with the given type and concurrency.
+ * This method is the same as the prepareCall
method
+ * above, but it allows the default result set
+ * type, result set concurrency type and holdability to be overridden.
+ *
+ * @param sql a String
object that is the SQL statement to
+ * be sent to the database; may contain on or more ? parameters
+ * @param resultSetType one of the following ResultSet
+ * constants:
+ * ResultSet.TYPE_FORWARD_ONLY
,
+ * ResultSet.TYPE_SCROLL_INSENSITIVE
, or
+ * ResultSet.TYPE_SCROLL_SENSITIVE
+ * @param resultSetConcurrency one of the following ResultSet
+ * constants:
+ * ResultSet.CONCUR_READ_ONLY
or
+ * ResultSet.CONCUR_UPDATABLE
+ * @param resultSetHoldability one of the following ResultSet
+ * constants:
+ * ResultSet.HOLD_CURSORS_OVER_COMMIT
or
+ * ResultSet.CLOSE_CURSORS_AT_COMMIT
+ * @return a new CallableStatement
object, containing the
+ * pre-compiled SQL statement, that will generate
+ * ResultSet
objects with the given type,
+ * concurrency, and holdability
+ * @exception SQLException if a database access error occurs
+ * or the given parameters are not ResultSet
+ * constants indicating type, concurrency, and holdability
+ * @see ResultSet
+ * @since 1.4
+ */
+ public CallableStatement prepareCall(String sql, int resultSetType,
+ int resultSetConcurrency,
+ int resultSetHoldability) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+
+
+ /**
+ * Creates a default PreparedStatement
object that has
+ * the capability to retrieve auto-generated keys. The given constant
+ * tells the driver whether it should make auto-generated keys
+ * available for retrieval. This parameter is ignored if the SQL
+ * statement is not an INSERT
statement.
+ * prepareStatement
will send
+ * the statement to the database for precompilation. Some drivers
+ * may not support precompilation. In this case, the statement may
+ * not be sent to the database until the PreparedStatement
+ * object is executed. This has no direct effect on users; however, it does
+ * affect which methods throw certain SQLExceptions.
+ * PreparedStatement
+ * object will by default be type TYPE_FORWARD_ONLY
+ * and have a concurrency level of CONCUR_READ_ONLY
.
+ *
+ * @param sql an SQL statement that may contain one or more '?' IN
+ * parameter placeholders
+ * @param autoGeneratedKeys a flag indicating whether auto-generated keys
+ * should be returned; one of the following Statement
+ * constants:
+ * @param autoGeneratedKeys a flag indicating that auto-generated keys should be returned, one of
+ * Statement.RETURN_GENERATED_KEYS
or
+ * Statement.NO_GENERATED_KEYS
.
+ * @return a new PreparedStatement
object, containing the
+ * pre-compiled SQL statement, that will have the capability of
+ * returning auto-generated keys
+ * @exception SQLException if a database access error occurs
+ * or the given parameter is not a Statement
+ * constant indicating whether auto-generated keys should be
+ * returned
+ * @since 1.4
+ */
+ public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+
+ /**
+ * Creates a default PreparedStatement
object capable
+ * of returning the auto-generated keys designated by the given array.
+ * This array contains the indexes of the columns in the target
+ * table that contain the auto-generated keys that should be made
+ * available. This array is ignored if the SQL
+ * statement is not an INSERT
statement.
+ * PreparedStatement
object. This
+ * object can then be used to efficiently execute this statement
+ * multiple times.
+ * prepareStatement
will send
+ * the statement to the database for precompilation. Some drivers
+ * may not support precompilation. In this case, the statement may
+ * not be sent to the database until the PreparedStatement
+ * object is executed. This has no direct effect on users; however, it does
+ * affect which methods throw certain SQLExceptions.
+ * PreparedStatement
+ * object will by default be type TYPE_FORWARD_ONLY
+ * and have a concurrency level of CONCUR_READ_ONLY
.
+ *
+ * @param sql an SQL statement that may contain one or more '?' IN
+ * parameter placeholders
+ * @param columnIndexes an array of column indexes indicating the columns
+ * that should be returned from the inserted row or rows
+ * @return a new PreparedStatement
object, containing the
+ * pre-compiled statement, that is capable of returning the
+ * auto-generated keys designated by the given array of column
+ * indexes
+ * @exception SQLException if a database access error occurs
+ *
+ * @since 1.4
+ */
+ public PreparedStatement prepareStatement(String sql, int columnIndexes[])
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+
+ /**
+ * Creates a default PreparedStatement
object capable
+ * of returning the auto-generated keys designated by the given array.
+ * This array contains the names of the columns in the target
+ * table that contain the auto-generated keys that should be returned.
+ * This array is ignored if the SQL
+ * statement is not an INSERT
statement.
+ * PreparedStatement
object. This
+ * object can then be used to efficiently execute this statement
+ * multiple times.
+ * prepareStatement
will send
+ * the statement to the database for precompilation. Some drivers
+ * may not support precompilation. In this case, the statement may
+ * not be sent to the database until the PreparedStatement
+ * object is executed. This has no direct effect on users; however, it does
+ * affect which methods throw certain SQLExceptions.
+ * PreparedStatement
+ * object will by default be type TYPE_FORWARD_ONLY
+ * and have a concurrency level of CONCUR_READ_ONLY
.
+ *
+ * @param sql an SQL statement that may contain one or more '?' IN
+ * parameter placeholders
+ * @param columnNames an array of column names indicating the columns
+ * that should be returned from the inserted row or rows
+ * @return a new PreparedStatement
object, containing the
+ * pre-compiled statement, that is capable of returning the
+ * auto-generated keys designated by the given array of column
+ * names
+ * @exception SQLException if a database access error occurs
+ *
+ * @since 1.4
+ */
+ public PreparedStatement prepareStatement(String sql, String columnNames[])
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Creates a default PreparedStatement
object capable
- * of returning the auto-generated keys designated by the given array.
- * This array contains the names of the columns in the target
- * table that contain the auto-generated keys that should be returned.
- * This array is ignored if the SQL
- * statement is not an INSERT
statement.
- * PreparedStatement
object. This
- * object can then be used to efficiently execute this statement
- * multiple times.
- * prepareStatement
will send
- * the statement to the database for precompilation. Some drivers
- * may not support precompilation. In this case, the statement may
- * not be sent to the database until the PreparedStatement
- * object is executed. This has no direct effect on users; however, it does
- * affect which methods throw certain SQLExceptions.
- * PreparedStatement
- * object will by default be type TYPE_FORWARD_ONLY
- * and have a concurrency level of CONCUR_READ_ONLY
.
- *
- * @param sql an SQL statement that may contain one or more '?' IN
- * parameter placeholders
- * @param columnNames an array of column names indicating the columns
- * that should be returned from the inserted row or rows
- * @return a new PreparedStatement
object, containing the
- * pre-compiled statement, that is capable of returning the
- * auto-generated keys designated by the given array of column
- * names
- * @exception SQLException if a database access error occurs
- *
- * @since 1.4
- */
- public PreparedStatement prepareStatement(String sql, String columnNames[])
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java
index 0c2e61d3a266f933b3a5fc47056cb0f3470ba4bf..5d34547737dad5bb08040aa332a3d5f9b64eb840 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java
@@ -8,332 +8,348 @@ public abstract class AbstractJdbc3DatabaseMetaData extends org.postgresql.jdbc2
public AbstractJdbc3DatabaseMetaData(AbstractJdbc3Connection conn)
{
- super(conn);
+ super(conn);
}
- /**
- * Retrieves whether this database supports savepoints.
- *
- * @return true
if savepoints are supported;
- * false
otherwise
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public boolean supportsSavepoints() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves whether this database supports savepoints.
+ *
+ * @return true
if savepoints are supported;
+ * false
otherwise
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public boolean supportsSavepoints() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves whether this database supports named parameters to callable
- * statements.
- *
- * @return true
if named parameters are supported;
- * false
otherwise
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public boolean supportsNamedParameters() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves whether this database supports named parameters to callable
+ * statements.
+ *
+ * @return true
if named parameters are supported;
+ * false
otherwise
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public boolean supportsNamedParameters() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves whether it is possible to have multiple ResultSet
objects
- * returned from a CallableStatement
object
- * simultaneously.
- *
- * @return true
if a CallableStatement
object
- * can return multiple ResultSet
objects
- * simultaneously; false
otherwise
- * @exception SQLException if a datanase access error occurs
- * @since 1.4
- */
- public boolean supportsMultipleOpenResults() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves whether it is possible to have multiple ResultSet
objects
+ * returned from a CallableStatement
object
+ * simultaneously.
+ *
+ * @return true
if a CallableStatement
object
+ * can return multiple ResultSet
objects
+ * simultaneously; false
otherwise
+ * @exception SQLException if a datanase access error occurs
+ * @since 1.4
+ */
+ public boolean supportsMultipleOpenResults() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves whether auto-generated keys can be retrieved after
- * a statement has been executed.
- *
- * @return true
if auto-generated keys can be retrieved
- * after a statement has executed; false
otherwise
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public boolean supportsGetGeneratedKeys() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves whether auto-generated keys can be retrieved after
+ * a statement has been executed.
+ *
+ * @return true
if auto-generated keys can be retrieved
+ * after a statement has executed; false
otherwise
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public boolean supportsGetGeneratedKeys() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves a description of the user-defined type (UDT) hierarchies defined in a
- * particular schema in this database. Only the immediate super type/
- * sub type relationship is modeled.
- * ResultSet
object returned by this method
- * describes the designated UDT and a direct supertype. A row has the following
- * columns:
- *
- *
- *
- * null
)
- * null
)
- * null
)
- * null
)
- * null
means drop catalog name from the selection criteria
- * @param schemaPattern a schema name pattern; "" retrieves those
- * without a schema
- * @param typeNamePattern a UDT name pattern; may be a fully-qualified
- * name
- * @return a ResultSet
object in which a row gives information
- * about the designated UDT
- * @throws SQLException if a database access error occurs
- * @since 1.4
- */
- public ResultSet getSuperTypes(String catalog, String schemaPattern,
- String typeNamePattern) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves a description of the table hierarchies defined in a particular
- * schema in this database.
- *
- *
- *
- *
- * null
)
- * null
)
- * null
means drop catalog name from the selection criteria
- * @param schemaPattern a schema name pattern; "" retrieves those
- * without a schema
- * @param tableNamePattern a table name pattern; may be a fully-qualified
- * name
- * @return a ResultSet
object in which each row is a type description
- * @throws SQLException if a database access error occurs
- * @since 1.4
- */
- public ResultSet getSuperTables(String catalog, String schemaPattern,
- String tableNamePattern) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves a description of the user-defined type (UDT) hierarchies defined in a
+ * particular schema in this database. Only the immediate super type/
+ * sub type relationship is modeled.
+ * ResultSet
object returned by this method
+ * describes the designated UDT and a direct supertype. A row has the following
+ * columns:
+ *
+ *
+ *
+ * null
)
+ * null
)
+ * null
)
+ * null
)
+ * null
means drop catalog name from the selection criteria
+ * @param schemaPattern a schema name pattern; "" retrieves those
+ * without a schema
+ * @param typeNamePattern a UDT name pattern; may be a fully-qualified
+ * name
+ * @return a ResultSet
object in which a row gives information
+ * about the designated UDT
+ * @throws SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public ResultSet getSuperTypes(String catalog, String schemaPattern,
+ String typeNamePattern) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves a description of the given attribute of the given type
- * for a user-defined type (UDT) that is available in the given schema
- * and catalog.
- * ResultSet
object that is returned has the following
- * columns:
- *
- *
- * @param catalog a catalog name; must match the catalog name as it
- * is stored in the database; "" retrieves those without a catalog;
- * null
)
- * null
)
- *
- *
- * null
)
- * null
)
- * null
if DATA_TYPE isn't REF)
- * null
if DATA_TYPE isn't REF)
- * null
if the DATA_TYPE isn't REF)
- * null
if DATA_TYPE
- * isn't DISTINCT or user-generated REF)
- * null
means that the catalog name should not be used to narrow
- * the search
- * @param schemaPattern a schema name pattern; must match the schema name
- * as it is stored in the database; "" retrieves those without a schema;
- * null
means that the schema name should not be used to narrow
- * the search
- * @param typeNamePattern a type name pattern; must match the
- * type name as it is stored in the database
- * @param attributeNamePattern an attribute name pattern; must match the attribute
- * name as it is declared in the database
- * @return a ResultSet
object in which each row is an
- * attribute description
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public ResultSet getAttributes(String catalog, String schemaPattern,
- String typeNamePattern, String attributeNamePattern)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves a description of the table hierarchies defined in a particular
+ * schema in this database.
+ *
+ *
+ *
+ *
+ * null
)
+ * null
)
+ * null
means drop catalog name from the selection criteria
+ * @param schemaPattern a schema name pattern; "" retrieves those
+ * without a schema
+ * @param tableNamePattern a table name pattern; may be a fully-qualified
+ * name
+ * @return a ResultSet
object in which each row is a type description
+ * @throws SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public ResultSet getSuperTables(String catalog, String schemaPattern,
+ String tableNamePattern) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves whether this database supports the given result set holdability.
- *
- * @param holdability one of the following constants:
- * ResultSet.HOLD_CURSORS_OVER_COMMIT
or
- * ResultSet.CLOSE_CURSORS_AT_COMMIT
- * @return
true
if so; false
otherwise
- * @exception SQLException if a database access error occurs
- * @see Connection
- * @since 1.4
- */
- public boolean supportsResultSetHoldability(int holdability) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves a description of the given attribute of the given type
+ * for a user-defined type (UDT) that is available in the given schema
+ * and catalog.
+ * ResultSet
object that is returned has the following
+ * columns:
+ *
+ *
+ * @param catalog a catalog name; must match the catalog name as it
+ * is stored in the database; "" retrieves those without a catalog;
+ * null
)
+ * null
)
+ *
+ *
+ * null
)
+ * null
)
+ * null
if DATA_TYPE isn't REF)
+ * null
if DATA_TYPE isn't REF)
+ * null
if the DATA_TYPE isn't REF)
+ * null
if DATA_TYPE
+ * isn't DISTINCT or user-generated REF)
+ * null
means that the catalog name should not be used to narrow
+ * the search
+ * @param schemaPattern a schema name pattern; must match the schema name
+ * as it is stored in the database; "" retrieves those without a schema;
+ * null
means that the schema name should not be used to narrow
+ * the search
+ * @param typeNamePattern a type name pattern; must match the
+ * type name as it is stored in the database
+ * @param attributeNamePattern an attribute name pattern; must match the attribute
+ * name as it is declared in the database
+ * @return a ResultSet
object in which each row is an
+ * attribute description
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public ResultSet getAttributes(String catalog, String schemaPattern,
+ String typeNamePattern, String attributeNamePattern)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves the default holdability of this ResultSet
- * object.
- *
- * @return the default holdability; either
- * ResultSet.HOLD_CURSORS_OVER_COMMIT
or
- * ResultSet.CLOSE_CURSORS_AT_COMMIT
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public int getResultSetHoldability() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves whether this database supports the given result set holdability.
+ *
+ * @param holdability one of the following constants:
+ * ResultSet.HOLD_CURSORS_OVER_COMMIT
or
+ * ResultSet.CLOSE_CURSORS_AT_COMMIT
+ * @return
true
if so; false
otherwise
+ * @exception SQLException if a database access error occurs
+ * @see Connection
+ * @since 1.4
+ */
+ public boolean supportsResultSetHoldability(int holdability) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves the major version number of the underlying database.
- *
- * @return the underlying database's major version
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public int getDatabaseMajorVersion() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves the default holdability of this ResultSet
+ * object.
+ *
+ * @return the default holdability; either
+ * ResultSet.HOLD_CURSORS_OVER_COMMIT
or
+ * ResultSet.CLOSE_CURSORS_AT_COMMIT
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public int getResultSetHoldability() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the major version number of the underlying database.
+ *
+ * @return the underlying database's major version
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public int getDatabaseMajorVersion() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves the minor version number of the underlying database.
- *
- * @return underlying database's minor version
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public int getDatabaseMinorVersion() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves the minor version number of the underlying database.
+ *
+ * @return underlying database's minor version
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public int getDatabaseMinorVersion() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves the major JDBC version number for this
- * driver.
- *
- * @return JDBC version major number
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public int getJDBCMajorVersion() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves the major JDBC version number for this
+ * driver.
+ *
+ * @return JDBC version major number
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public int getJDBCMajorVersion() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves the minor JDBC version number for this
- * driver.
- *
- * @return JDBC version minor number
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public int getJDBCMinorVersion() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves the minor JDBC version number for this
+ * driver.
+ *
+ * @return JDBC version minor number
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public int getJDBCMinorVersion() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Indicates whether the SQLSTATEs returned by SQLException.getSQLState
- * is X/Open (now known as Open Group) SQL CLI or SQL99.
- * @return the type of SQLSTATEs, one of:
- * sqlStateXOpen or
- * sqlStateSQL99
- * @throws SQLException if a database access error occurs
- * @since 1.4
- */
- public int getSQLStateType() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Indicates whether the SQLSTATEs returned by SQLException.getSQLState
+ * is X/Open (now known as Open Group) SQL CLI or SQL99.
+ * @return the type of SQLSTATEs, one of:
+ * sqlStateXOpen or
+ * sqlStateSQL99
+ * @throws SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public int getSQLStateType() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Indicates whether updates made to a LOB are made on a copy or directly
- * to the LOB.
- * @return true
if updates are made to a copy of the LOB;
- * false
if updates are made directly to the LOB
- * @throws SQLException if a database access error occurs
- * @since 1.4
- */
- public boolean locatorsUpdateCopy() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Indicates whether updates made to a LOB are made on a copy or directly
+ * to the LOB.
+ * @return true
if updates are made to a copy of the LOB;
+ * false
if updates are made directly to the LOB
+ * @throws SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public boolean locatorsUpdateCopy() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
- /**
- * Retrieves weather this database supports statement pooling.
- *
- * @return true
is so;
- false
otherwise
- * @throws SQLExcpetion if a database access error occurs
- * @since 1.4
- */
- public boolean supportsStatementPooling() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Retrieves weather this database supports statement pooling.
+ *
+ * @return true
is so;
+ false
otherwise
+ * @throws SQLExcpetion if a database access error occurs
+ * @since 1.4
+ */
+ public boolean supportsStatementPooling() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java
index cc1609d6462b5a18ac9be27165d1b2d738f92bd2..4be956e0439ddc6d5c346ad7c0b2958a01946542 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java
@@ -4,178 +4,190 @@ package org.postgresql.jdbc3;
import java.sql.*;
import java.util.Vector;
-/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3ResultSet.java,v 1.1 2002/08/14 20:35:39 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3ResultSet.java,v 1.2 2002/09/06 21:23:06 momjian Exp $
* This class defines methods of the jdbc3 specification. This class extends
* org.postgresql.jdbc2.AbstractJdbc2ResultSet which provides the jdbc2
* methods. The real Statement class (for jdbc3) is org.postgresql.jdbc3.Jdbc3ResultSet
*/
-public abstract class AbstractJdbc3ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet {
-
- public AbstractJdbc3ResultSet(org.postgresql.PGConnection conn, Statement statement, org.postgresql.Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) {
- super (conn, statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
- }
-
- /**
- * Retrieves the value of the designated column in the current row
- * of this ResultSet
object as a java.net.URL
- * object in the Java programming language.
- *
- * @param columnIndex the index of the column 1 is the first, 2 is the second,...
- * @return the column value as a java.net.URL
object;
- * if the value is SQL NULL
,
- * the value returned is null
in the Java programming language
- * @exception SQLException if a database access error occurs,
- * or if a URL is malformed
- * @since 1.4
- */
- public java.net.URL getURL(int columnIndex) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of the designated column in the current row
- * of this ResultSet
object as a java.net.URL
- * object in the Java programming language.
- *
- * @param columnName the SQL name of the column
- * @return the column value as a java.net.URL
object;
- * if the value is SQL NULL
,
- * the value returned is null
in the Java programming language
- * @exception SQLException if a database access error occurs
- * or if a URL is malformed
- * @since 1.4
- */
- public java.net.URL getURL(String columnName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Updates the designated column with a java.sql.Ref
value.
- * The updater methods are used to update column values in the
- * current row or the insert row. The updater methods do not
- * update the underlying database; instead the updateRow
or
- * insertRow
methods are called to update the database.
- *
- * @param columnIndex the first column is 1, the second is 2, ...
- * @param x the new column value
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public void updateRef(int columnIndex, java.sql.Ref x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Updates the designated column with a java.sql.Ref
value.
- * The updater methods are used to update column values in the
- * current row or the insert row. The updater methods do not
- * update the underlying database; instead the updateRow
or
- * insertRow
methods are called to update the database.
- *
- * @param columnName the name of the column
- * @param x the new column value
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public void updateRef(String columnName, java.sql.Ref x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Updates the designated column with a java.sql.Blob
value.
- * The updater methods are used to update column values in the
- * current row or the insert row. The updater methods do not
- * update the underlying database; instead the updateRow
or
- * insertRow
methods are called to update the database.
- *
- * @param columnIndex the first column is 1, the second is 2, ...
- * @param x the new column value
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public void updateBlob(int columnIndex, java.sql.Blob x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Updates the designated column with a java.sql.Blob
value.
- * The updater methods are used to update column values in the
- * current row or the insert row. The updater methods do not
- * update the underlying database; instead the updateRow
or
- * insertRow
methods are called to update the database.
- *
- * @param columnName the name of the column
- * @param x the new column value
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public void updateBlob(String columnName, java.sql.Blob x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Updates the designated column with a java.sql.Clob
value.
- * The updater methods are used to update column values in the
- * current row or the insert row. The updater methods do not
- * update the underlying database; instead the updateRow
or
- * insertRow
methods are called to update the database.
- *
- * @param columnIndex the first column is 1, the second is 2, ...
- * @param x the new column value
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public void updateClob(int columnIndex, java.sql.Clob x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Updates the designated column with a java.sql.Clob
value.
- * The updater methods are used to update column values in the
- * current row or the insert row. The updater methods do not
- * update the underlying database; instead the updateRow
or
- * insertRow
methods are called to update the database.
- *
- * @param columnName the name of the column
- * @param x the new column value
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public void updateClob(String columnName, java.sql.Clob x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Updates the designated column with a java.sql.Array
value.
- * The updater methods are used to update column values in the
- * current row or the insert row. The updater methods do not
- * update the underlying database; instead the updateRow
or
- * insertRow
methods are called to update the database.
- *
- * @param columnIndex the first column is 1, the second is 2, ...
- * @param x the new column value
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public void updateArray(int columnIndex, java.sql.Array x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Updates the designated column with a java.sql.Array
value.
- * The updater methods are used to update column values in the
- * current row or the insert row. The updater methods do not
- * update the underlying database; instead the updateRow
or
- * insertRow
methods are called to update the database.
- *
- * @param columnName the name of the column
- * @param x the new column value
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public void updateArray(String columnName, java.sql.Array x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+public abstract class AbstractJdbc3ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet
+{
+
+ public AbstractJdbc3ResultSet(org.postgresql.PGConnection conn, Statement statement, org.postgresql.Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
+ {
+ super (conn, statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
+ }
+
+ /**
+ * Retrieves the value of the designated column in the current row
+ * of this ResultSet
object as a java.net.URL
+ * object in the Java programming language.
+ *
+ * @param columnIndex the index of the column 1 is the first, 2 is the second,...
+ * @return the column value as a java.net.URL
object;
+ * if the value is SQL NULL
,
+ * the value returned is null
in the Java programming language
+ * @exception SQLException if a database access error occurs,
+ * or if a URL is malformed
+ * @since 1.4
+ */
+ public java.net.URL getURL(int columnIndex) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of the designated column in the current row
+ * of this ResultSet
object as a java.net.URL
+ * object in the Java programming language.
+ *
+ * @param columnName the SQL name of the column
+ * @return the column value as a java.net.URL
object;
+ * if the value is SQL NULL
,
+ * the value returned is null
in the Java programming language
+ * @exception SQLException if a database access error occurs
+ * or if a URL is malformed
+ * @since 1.4
+ */
+ public java.net.URL getURL(String columnName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Updates the designated column with a java.sql.Ref
value.
+ * The updater methods are used to update column values in the
+ * current row or the insert row. The updater methods do not
+ * update the underlying database; instead the updateRow
or
+ * insertRow
methods are called to update the database.
+ *
+ * @param columnIndex the first column is 1, the second is 2, ...
+ * @param x the new column value
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public void updateRef(int columnIndex, java.sql.Ref x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Updates the designated column with a java.sql.Ref
value.
+ * The updater methods are used to update column values in the
+ * current row or the insert row. The updater methods do not
+ * update the underlying database; instead the updateRow
or
+ * insertRow
methods are called to update the database.
+ *
+ * @param columnName the name of the column
+ * @param x the new column value
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public void updateRef(String columnName, java.sql.Ref x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Updates the designated column with a java.sql.Blob
value.
+ * The updater methods are used to update column values in the
+ * current row or the insert row. The updater methods do not
+ * update the underlying database; instead the updateRow
or
+ * insertRow
methods are called to update the database.
+ *
+ * @param columnIndex the first column is 1, the second is 2, ...
+ * @param x the new column value
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public void updateBlob(int columnIndex, java.sql.Blob x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Updates the designated column with a java.sql.Blob
value.
+ * The updater methods are used to update column values in the
+ * current row or the insert row. The updater methods do not
+ * update the underlying database; instead the updateRow
or
+ * insertRow
methods are called to update the database.
+ *
+ * @param columnName the name of the column
+ * @param x the new column value
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public void updateBlob(String columnName, java.sql.Blob x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Updates the designated column with a java.sql.Clob
value.
+ * The updater methods are used to update column values in the
+ * current row or the insert row. The updater methods do not
+ * update the underlying database; instead the updateRow
or
+ * insertRow
methods are called to update the database.
+ *
+ * @param columnIndex the first column is 1, the second is 2, ...
+ * @param x the new column value
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public void updateClob(int columnIndex, java.sql.Clob x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Updates the designated column with a java.sql.Clob
value.
+ * The updater methods are used to update column values in the
+ * current row or the insert row. The updater methods do not
+ * update the underlying database; instead the updateRow
or
+ * insertRow
methods are called to update the database.
+ *
+ * @param columnName the name of the column
+ * @param x the new column value
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public void updateClob(String columnName, java.sql.Clob x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Updates the designated column with a java.sql.Array
value.
+ * The updater methods are used to update column values in the
+ * current row or the insert row. The updater methods do not
+ * update the underlying database; instead the updateRow
or
+ * insertRow
methods are called to update the database.
+ *
+ * @param columnIndex the first column is 1, the second is 2, ...
+ * @param x the new column value
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public void updateArray(int columnIndex, java.sql.Array x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Updates the designated column with a java.sql.Array
value.
+ * The updater methods are used to update column values in the
+ * current row or the insert row. The updater methods do not
+ * update the underlying database; instead the updateRow
or
+ * insertRow
methods are called to update the database.
+ *
+ * @param columnName the name of the column
+ * @param x the new column value
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public void updateArray(String columnName, java.sql.Array x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Statement.java
index 8b18e6153d9617290097ecdf11f02e0497eeb163..9db54ae215170880a6a98d7021850bcc13487e7b 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Statement.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Statement.java
@@ -5,7 +5,7 @@ import java.math.BigDecimal;
import java.sql.*;
import java.util.Calendar;
-/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3Statement.java,v 1.1 2002/08/14 20:35:39 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3Statement.java,v 1.2 2002/09/06 21:23:06 momjian Exp $
* This class defines methods of the jdbc3 specification. This class extends
* org.postgresql.jdbc2.AbstractJdbc2Statement which provides the jdbc2
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc3.Jdbc3Statement
@@ -23,1278 +23,1341 @@ public abstract class AbstractJdbc3Statement extends org.postgresql.jdbc2.Abstra
super(connection, sql);
}
- /**
- * Moves to this Statement
object's next result, deals with
- * any current ResultSet
object(s) according to the instructions
- * specified by the given flag, and returns
- * true
if the next result is a ResultSet
object.
- *
- *
- *
- *
- * @param current one of the following (!getMoreResults() && (getUpdateCount() == -1)
- * Statement
- * constants indicating what should happen to current
- * ResultSet
objects obtained using the method
- * getResultSetCLOSE_CURRENT_RESULT
,
- * KEEP_CURRENT_RESULT
, or
- * CLOSE_ALL_RESULTS
- * @return true
if the next result is a ResultSet
- * object; false
if it is an update count or there are no
- * more results
- * @exception SQLException if a database access error occurs
- * @since 1.4
- * @see #execute
- */
- public boolean getMoreResults(int current) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves any auto-generated keys created as a result of executing this
- * Statement
object. If this Statement
object did
- * not generate any keys, an empty ResultSet
- * object is returned.
- *
- * @return a ResultSet
object containing the auto-generated key(s)
- * generated by the execution of this Statement
object
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public ResultSet getGeneratedKeys() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Executes the given SQL statement and signals the driver with the
- * given flag about whether the
- * auto-generated keys produced by this Statement
object
- * should be made available for retrieval.
- *
- * @param sql must be an SQL INSERT
, UPDATE
or
- * DELETE
statement or an SQL statement that
- * returns nothing
- * @param autoGeneratedKeys a flag indicating whether auto-generated keys
- * should be made available for retrieval;
- * one of the following constants:
- * Statement.RETURN_GENERATED_KEYS
- * Statement.NO_GENERATED_KEYS
- * @return either the row count for INSERT
, UPDATE
- * or DELETE
statements, or 0
for SQL
- * statements that return nothing
- * @exception SQLException if a database access error occurs, the given
- * SQL statement returns a ResultSet
object, or
- * the given constant is not one of those allowed
- * @since 1.4
- */
- public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Executes the given SQL statement and signals the driver that the
- * auto-generated keys indicated in the given array should be made available
- * for retrieval. The driver will ignore the array if the SQL statement
- * is not an INSERT
statement.
- *
- * @param sql an SQL INSERT
, UPDATE
or
- * DELETE
statement or an SQL statement that returns nothing,
- * such as an SQL DDL statement
- * @param columnIndexes an array of column indexes indicating the columns
- * that should be returned from the inserted row
- * @return either the row count for INSERT
, UPDATE
,
- * or DELETE
statements, or 0 for SQL statements
- * that return nothing
- * @exception SQLException if a database access error occurs or the SQL
- * statement returns a ResultSet
object
- * @since 1.4
- */
- public int executeUpdate(String sql, int columnIndexes[]) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Executes the given SQL statement and signals the driver that the
- * auto-generated keys indicated in the given array should be made available
- * for retrieval. The driver will ignore the array if the SQL statement
- * is not an INSERT
statement.
- *
- * @param sql an SQL INSERT
, UPDATE
or
- * DELETE
statement or an SQL statement that returns nothing
- * @param columnNames an array of the names of the columns that should be
- * returned from the inserted row
- * @return either the row count for INSERT
, UPDATE
,
- * or DELETE
statements, or 0 for SQL statements
- * that return nothing
- * @exception SQLException if a database access error occurs
- *
- * @since 1.4
- */
- public int executeUpdate(String sql, String columnNames[]) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Executes the given SQL statement, which may return multiple results,
- * and signals the driver that any
- * auto-generated keys should be made available
- * for retrieval. The driver will ignore this signal if the SQL statement
- * is not an INSERT
statement.
- * execute
method executes an SQL statement and indicates the
- * form of the first result. You must then use the methods
- * getResultSet
or getUpdateCount
- * to retrieve the result, and getMoreResults
to
- * move to any subsequent result(s).
- *
- * @param sql any SQL statement
- * @param autoGeneratedKeys a constant indicating whether auto-generated
- * keys should be made available for retrieval using the method
- * getGeneratedKeys
; one of the following constants:
- * Statement.RETURN_GENERATED_KEYS
or
- * Statement.NO_GENERATED_KEYS
- * @return true
if the first result is a ResultSet
- * object; false
if it is an update count or there are
- * no results
- * @exception SQLException if a database access error occurs
- * @see #getResultSet
- * @see #getUpdateCount
- * @see #getMoreResults
- * @see #getGeneratedKeys
- *
- * @since 1.4
- */
- public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Executes the given SQL statement, which may return multiple results,
- * and signals the driver that the
- * auto-generated keys indicated in the given array should be made available
- * for retrieval. This array contains the indexes of the columns in the
- * target table that contain the auto-generated keys that should be made
- * available. The driver will ignore the array if the given SQL statement
- * is not an INSERT
statement.
- * execute
method executes an SQL statement and indicates the
- * form of the first result. You must then use the methods
- * getResultSet
or getUpdateCount
- * to retrieve the result, and getMoreResults
to
- * move to any subsequent result(s).
- *
- * @param sql any SQL statement
- * @param columnIndexes an array of the indexes of the columns in the
- * inserted row that should be made available for retrieval by a
- * call to the method getGeneratedKeys
- * @return true
if the first result is a ResultSet
- * object; false
if it is an update count or there
- * are no results
- * @exception SQLException if a database access error occurs
- * @see #getResultSet
- * @see #getUpdateCount
- * @see #getMoreResults
- *
- * @since 1.4
- */
- public boolean execute(String sql, int columnIndexes[]) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Executes the given SQL statement, which may return multiple results,
- * and signals the driver that the
- * auto-generated keys indicated in the given array should be made available
- * for retrieval. This array contains the names of the columns in the
- * target table that contain the auto-generated keys that should be made
- * available. The driver will ignore the array if the given SQL statement
- * is not an INSERT
statement.
- * execute
method executes an SQL statement and indicates the
- * form of the first result. You must then use the methods
- * getResultSet
or getUpdateCount
- * to retrieve the result, and getMoreResults
to
- * move to any subsequent result(s).
- *
- * @param sql any SQL statement
- * @param columnNames an array of the names of the columns in the inserted
- * row that should be made available for retrieval by a call to the
- * method getGeneratedKeys
- * @return true
if the next result is a ResultSet
- * object; false
if it is an update count or there
- * are no more results
- * @exception SQLException if a database access error occurs
- * @see #getResultSet
- * @see #getUpdateCount
- * @see #getMoreResults
- * @see #getGeneratedKeys
- *
- * @since 1.4
- */
- public boolean execute(String sql, String columnNames[]) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the result set holdability for ResultSet
objects
- * generated by this Statement
object.
- *
- * @return either ResultSet.HOLD_CURSORS_OVER_COMMIT
or
- * ResultSet.CLOSE_CURSORS_AT_COMMIT
- * @exception SQLException if a database access error occurs
- *
- * @since 1.4
- */
- public int getResultSetHoldability() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given java.net.URL
value.
- * The driver converts this to an SQL DATALINK
value
- * when it sends it to the database.
- *
- * @param parameterIndex the first parameter is 1, the second is 2, ...
- * @param x the java.net.URL
object to be set
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public void setURL(int parameterIndex, java.net.URL x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the number, types and properties of this
- * PreparedStatement
object's parameters.
- *
- * @return a ParameterMetaData
object that contains information
- * about the number, types and properties of this
- * PreparedStatement
object's parameters
- * @exception SQLException if a database access error occurs
- * @see ParameterMetaData
- * @since 1.4
- */
- public ParameterMetaData getParameterMetaData() throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Registers the OUT parameter named
- * parameterName
to the JDBC type
- * sqlType
. All OUT parameters must be registered
- * before a stored procedure is executed.
- * sqlType
for an OUT
- * parameter determines the Java type that must be used
- * in the get
method to read the value of that parameter.
- * sqlType
- * should be java.sql.Types.OTHER
. The method
- * {@link #getObject} retrieves the value.
- * @param parameterName the name of the parameter
- * @param sqlType the JDBC type code defined by java.sql.Types
.
- * If the parameter is of JDBC type NUMERIC
- * or DECIMAL
, the version of
- * registerOutParameter
that accepts a scale value
- * should be used.
- * @exception SQLException if a database access error occurs
- * @since 1.4
- * @see Types
- */
- public void registerOutParameter(String parameterName, int sqlType)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Registers the parameter named
- * parameterName
to be of JDBC type
- * sqlType
. This method must be called
- * before a stored procedure is executed.
- * sqlType
for an OUT
- * parameter determines the Java type that must be used
- * in the get
method to read the value of that parameter.
- * registerOutParameter
should be
- * used when the parameter is of JDBC type NUMERIC
- * or DECIMAL
.
- * @param parameterName the name of the parameter
- * @param sqlType SQL type code defined by java.sql.Types
.
- * @param scale the desired number of digits to the right of the
- * decimal point. It must be greater than or equal to zero.
- * @exception SQLException if a database access error occurs
- * @since 1.4
- * @see Types
- */
- public void registerOutParameter(String parameterName, int sqlType, int scale)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Registers the designated output parameter. This version of
- * the method registerOutParameter
- * should be used for a user-named or REF output parameter. Examples
- * of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and
- * named array types.
- *
- * Before executing a stored procedure call, you must explicitly
- * call registerOutParameter
to register the type from
- * java.sql.Types
for each
- * OUT parameter. For a user-named parameter the fully-qualified SQL
- * type name of the parameter should also be given, while a REF
- * parameter requires that the fully-qualified type name of the
- * referenced type be given. A JDBC driver that does not need the
- * type code and type name information may ignore it. To be portable,
- * however, applications should always provide these values for
- * user-named and REF parameters.
- *
- * Although it is intended for user-named and REF parameters,
- * this method may be used to register a parameter of any JDBC type.
- * If the parameter does not have a user-named or REF type, the
- * typeName parameter is ignored.
- *
- * getXXX
method whose Java type XXX corresponds to the
- * parameter's registered SQL type.
- *
- * @param parameterName the name of the parameter
- * @param sqlType a value from {@link java.sql.Types}
- * @param typeName the fully-qualified name of an SQL structured type
- * @exception SQLException if a database access error occurs
- * @see Types
- * @since 1.4
- */
- public void registerOutParameter (String parameterName, int sqlType, String typeName)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of the designated JDBC DATALINK
parameter as a
- * java.net.URL
object.
- *
- * @param parameterIndex the first parameter is 1, the second is 2,...
- * @return a java.net.URL
object that represents the
- * JDBC DATALINK
value used as the designated
- * parameter
- * @exception SQLException if a database access error occurs,
- * or if the URL being returned is
- * not a valid URL on the Java platform
- * @see #setURL
- * @since 1.4
- */
- public java.net.URL getURL(int parameterIndex) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given java.net.URL
object.
- * The driver converts this to an SQL DATALINK
value when
- * it sends it to the database.
- *
- * @param parameterName the name of the parameter
- * @param val the parameter value
- * @exception SQLException if a database access error occurs,
- * or if a URL is malformed
- * @see #getURL
- * @since 1.4
- */
- public void setURL(String parameterName, java.net.URL val) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to SQL NULL
.
- *
- * java.sql.Types
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public void setNull(String parameterName, int sqlType) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given Java boolean
value.
- * The driver converts this
- * to an SQL BIT
value when it sends it to the database.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @exception SQLException if a database access error occurs
- * @see #getBoolean
- * @since 1.4
- */
- public void setBoolean(String parameterName, boolean x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given Java byte
value.
- * The driver converts this
- * to an SQL TINYINT
value when it sends it to the database.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @exception SQLException if a database access error occurs
- * @see #getByte
- * @since 1.4
- */
- public void setByte(String parameterName, byte x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given Java short
value.
- * The driver converts this
- * to an SQL SMALLINT
value when it sends it to the database.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @exception SQLException if a database access error occurs
- * @see #getShort
- * @since 1.4
- */
- public void setShort(String parameterName, short x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given Java int
value.
- * The driver converts this
- * to an SQL INTEGER
value when it sends it to the database.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @exception SQLException if a database access error occurs
- * @see #getInt
- * @since 1.4
- */
- public void setInt(String parameterName, int x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given Java long
value.
- * The driver converts this
- * to an SQL BIGINT
value when it sends it to the database.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @exception SQLException if a database access error occurs
- * @see #getLong
- * @since 1.4
- */
- public void setLong(String parameterName, long x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given Java float
value.
- * The driver converts this
- * to an SQL FLOAT
value when it sends it to the database.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @exception SQLException if a database access error occurs
- * @see #getFloat
- * @since 1.4
- */
- public void setFloat(String parameterName, float x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given Java double
value.
- * The driver converts this
- * to an SQL DOUBLE
value when it sends it to the database.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @exception SQLException if a database access error occurs
- * @see #getDouble
- * @since 1.4
- */
- public void setDouble(String parameterName, double x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given
- * java.math.BigDecimal
value.
- * The driver converts this to an SQL NUMERIC
value when
- * it sends it to the database.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @exception SQLException if a database access error occurs
- * @see #getBigDecimal
- * @since 1.4
- */
- public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given Java String
value.
- * The driver converts this
- * to an SQL VARCHAR
or LONGVARCHAR
value
- * (depending on the argument's
- * size relative to the driver's limits on VARCHAR
values)
- * when it sends it to the database.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @exception SQLException if a database access error occurs
- * @see #getString
- * @since 1.4
- */
- public void setString(String parameterName, String x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given Java array of bytes.
- * The driver converts this to an SQL VARBINARY
or
- * LONGVARBINARY
(depending on the argument's size relative
- * to the driver's limits on VARBINARY
values) when it sends
- * it to the database.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @exception SQLException if a database access error occurs
- * @see #getBytes
- * @since 1.4
- */
- public void setBytes(String parameterName, byte x[]) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given java.sql.Date
value.
- * The driver converts this
- * to an SQL DATE
value when it sends it to the database.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @exception SQLException if a database access error occurs
- * @see #getDate
- * @since 1.4
- */
- public void setDate(String parameterName, java.sql.Date x)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given java.sql.Time
value.
- * The driver converts this
- * to an SQL TIME
value when it sends it to the database.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @exception SQLException if a database access error occurs
- * @see #getTime
- * @since 1.4
- */
- public void setTime(String parameterName, java.sql.Time x)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given java.sql.Timestamp
value.
- * The driver
- * converts this to an SQL TIMESTAMP
value when it sends it to the
- * database.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @exception SQLException if a database access error occurs
- * @see #getTimestamp
- * @since 1.4
- */
- public void setTimestamp(String parameterName, java.sql.Timestamp x)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given input stream, which will have
- * the specified number of bytes.
- * 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
. Data will be read from the stream
- * as needed until end-of-file is reached. The JDBC driver will
- * do any necessary conversion from ASCII to the database char format.
- *
- * LONGVARBINARY
- * parameter, it may be more practical to send it via a
- * java.io.InputStream
object. The data will be read from the stream
- * as needed until end-of-file is reached.
- *
- * java.lang
equivalent objects should be used.
- *
- * SQLData
),
- * the JDBC driver should call the method SQLData.writeSQL
to write it
- * to the SQL data stream.
- * If, on the other hand, the object is of a class implementing
- * Ref
, Blob
, Clob
, Struct
,
- * or Array
, the driver should pass it to the database as a
- * value of the corresponding SQL type.
- * setObject
- * above, except that it assumes a scale of zero.
- *
- * @param parameterName the name of the parameter
- * @param x the object containing the input parameter value
- * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
- * sent to the database
- * @exception SQLException if a database access error occurs
- * @see #getObject
- * @since 1.4
- */
- public void setObject(String parameterName, Object x, int targetSqlType)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the value of the designated parameter with the given object.
- * The second parameter must be of type Object
; therefore, the
- * java.lang
equivalent objects should be used for built-in types.
- *
- * Object
types to SQL types. The given argument
- * will be converted to the corresponding SQL type before being
- * sent to the database.
- *
- * SQLData
,
- * the JDBC driver should call the method SQLData.writeSQL
- * to write it to the SQL data stream.
- * If, on the other hand, the object is of a class implementing
- * Ref
, Blob
, Clob
, Struct
,
- * or Array
, the driver should pass it to the database as a
- * value of the corresponding SQL type.
- * Object
parameter is ambiguous
- * @see #getObject
- * @since 1.4
- */
- public void setObject(String parameterName, Object x) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
-
- /**
- * Sets the designated parameter to the given Reader
- * object, which is the given number of characters long.
- * When a very large UNICODE value is input to a LONGVARCHAR
- * parameter, it may be more practical to send it via a
- * java.io.Reader
object. The data will be read from the stream
- * as needed until end-of-file is reached. The JDBC driver will
- * do any necessary conversion from UNICODE to the database char format.
- *
- * java.io.Reader
object that
- * contains the UNICODE data used as the designated parameter
- * @param length the number of characters in the stream
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public void setCharacterStream(String parameterName,
- java.io.Reader reader,
- int length) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given java.sql.Date
value,
- * using the given Calendar
object. The driver uses
- * the Calendar
object to construct an SQL DATE
value,
- * which the driver then sends to the database. With a
- * a Calendar
object, the driver can calculate the date
- * taking into account a custom timezone. If no
- * Calendar
object is specified, the driver uses the default
- * timezone, which is that of the virtual machine running the application.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @param cal the Calendar
object the driver will use
- * to construct the date
- * @exception SQLException if a database access error occurs
- * @see #getDate
- * @since 1.4
- */
- public void setDate(String parameterName, java.sql.Date x, Calendar cal)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given java.sql.Time
value,
- * using the given Calendar
object. The driver uses
- * the Calendar
object to construct an SQL TIME
value,
- * which the driver then sends to the database. With a
- * a Calendar
object, the driver can calculate the time
- * taking into account a custom timezone. If no
- * Calendar
object is specified, the driver uses the default
- * timezone, which is that of the virtual machine running the application.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @param cal the Calendar
object the driver will use
- * to construct the time
- * @exception SQLException if a database access error occurs
- * @see #getTime
- * @since 1.4
- */
- public void setTime(String parameterName, java.sql.Time x, Calendar cal)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to the given java.sql.Timestamp
value,
- * using the given Calendar
object. The driver uses
- * the Calendar
object to construct an SQL TIMESTAMP
value,
- * which the driver then sends to the database. With a
- * a Calendar
object, the driver can calculate the timestamp
- * taking into account a custom timezone. If no
- * Calendar
object is specified, the driver uses the default
- * timezone, which is that of the virtual machine running the application.
- *
- * @param parameterName the name of the parameter
- * @param x the parameter value
- * @param cal the Calendar
object the driver will use
- * to construct the timestamp
- * @exception SQLException if a database access error occurs
- * @see #getTimestamp
- * @since 1.4
- */
- public void setTimestamp(String parameterName, java.sql.Timestamp x, Calendar cal)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Sets the designated parameter to SQL NULL
.
- * This version of the method setNull
should
- * be used for user-defined types and REF type parameters. Examples
- * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and
- * named array types.
- *
- * java.sql.Types
- * @param typeName the fully-qualified name of an SQL user-defined type;
- * ignored if the parameter is not a user-defined type or
- * SQL REF
value
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public void setNull (String parameterName, int sqlType, String typeName)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC CHAR
, VARCHAR
,
- * or LONGVARCHAR
parameter as a String
in
- * the Java programming language.
- * CHAR
,
- * the String
object
- * returned has exactly the same value the JDBC
- * CHAR
value had in the
- * database, including any padding added by the database.
- * @param parameterName the name of the parameter
- * @return the parameter value. If the value is SQL NULL
, the result
- * is null
.
- * @exception SQLException if a database access error occurs
- * @see #setString
- * @since 1.4
- */
- public String getString(String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC BIT
parameter as a
- * boolean
in the Java programming language.
- * @param parameterName the name of the parameter
- * @return the parameter value. If the value is SQL NULL
, the result
- * is false
.
- * @exception SQLException if a database access error occurs
- * @see #setBoolean
- * @since 1.4
- */
- public boolean getBoolean(String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC TINYINT
parameter as a byte
- * in the Java programming language.
- * @param parameterName the name of the parameter
- * @return the parameter value. If the value is SQL NULL
, the result
- * is 0
.
- * @exception SQLException if a database access error occurs
- * @see #setByte
- * @since 1.4
- */
- public byte getByte(String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC SMALLINT
parameter as a short
- * in the Java programming language.
- * @param parameterName the name of the parameter
- * @return the parameter value. If the value is SQL NULL
, the result
- * is 0
.
- * @exception SQLException if a database access error occurs
- * @see #setShort
- * @since 1.4
- */
- public short getShort(String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC INTEGER
parameter as an int
- * in the Java programming language.
- *
- * @param parameterName the name of the parameter
- * @return the parameter value. If the value is SQL NULL
,
- * the result is 0
.
- * @exception SQLException if a database access error occurs
- * @see #setInt
- * @since 1.4
- */
- public int getInt(String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC BIGINT
parameter as a long
- * in the Java programming language.
- *
- * @param parameterName the name of the parameter
- * @return the parameter value. If the value is SQL NULL
,
- * the result is 0
.
- * @exception SQLException if a database access error occurs
- * @see #setLong
- * @since 1.4
- */
- public long getLong(String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC FLOAT
parameter as a float
- * in the Java programming language.
- * @param parameterName the name of the parameter
- * @return the parameter value. If the value is SQL NULL
,
- * the result is 0
.
- * @exception SQLException if a database access error occurs
- * @see #setFloat
- * @since 1.4
- */
- public float getFloat(String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC DOUBLE
parameter as a double
- * in the Java programming language.
- * @param parameterName the name of the parameter
- * @return the parameter value. If the value is SQL NULL
,
- * the result is 0
.
- * @exception SQLException if a database access error occurs
- * @see #setDouble
- * @since 1.4
- */
- public double getDouble(String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC BINARY
or VARBINARY
- * parameter as an array of byte
values in the Java
- * programming language.
- * @param parameterName the name of the parameter
- * @return the parameter value. If the value is SQL NULL
, the result is
- * null
.
- * @exception SQLException if a database access error occurs
- * @see #setBytes
- * @since 1.4
- */
- public byte[] getBytes(String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC DATE
parameter as a
- * java.sql.Date
object.
- * @param parameterName the name of the parameter
- * @return the parameter value. If the value is SQL NULL
, the result
- * is null
.
- * @exception SQLException if a database access error occurs
- * @see #setDate
- * @since 1.4
- */
- public java.sql.Date getDate(String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC TIME
parameter as a
- * java.sql.Time
object.
- * @param parameterName the name of the parameter
- * @return the parameter value. If the value is SQL NULL
, the result
- * is null
.
- * @exception SQLException if a database access error occurs
- * @see #setTime
- * @since 1.4
- */
- public java.sql.Time getTime(String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC TIMESTAMP
parameter as a
- * java.sql.Timestamp
object.
- * @param parameterName the name of the parameter
- * @return the parameter value. If the value is SQL NULL
, the result
- * is null
.
- * @exception SQLException if a database access error occurs
- * @see #setTimestamp
- * @since 1.4
- */
- public java.sql.Timestamp getTimestamp(String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a parameter as an Object
in the Java
- * programming language. If the value is an SQL NULL
, the
- * driver returns a Java null
.
- * registerOutParameter
. By registering the target JDBC
- * type as java.sql.Types.OTHER
, this method can be used
- * to read database-specific abstract data types.
- * @param parameterName the name of the parameter
- * @return A java.lang.Object
holding the OUT parameter value.
- * @exception SQLException if a database access error occurs
- * @see Types
- * @see #setObject
- * @since 1.4
- */
- public Object getObject(String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC NUMERIC
parameter as a
- * java.math.BigDecimal
object with as many digits to the
- * right of the decimal point as the value contains.
- * @param parameterName the name of the parameter
- * @return the parameter value in full precision. If the value is
- * SQL NULL
, the result is null
.
- * @exception SQLException if a database access error occurs
- * @see #setBigDecimal
- * @since 1.4
- */
- public BigDecimal getBigDecimal(String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Returns an object representing the value of OUT parameter
- * i
and uses map
for the custom
- * mapping of the parameter value.
- * registerOutParameter
. By registering the target
- * JDBC type as java.sql.Types.OTHER
, this method can
- * be used to read database-specific abstract data types.
- * @param parameterName the name of the parameter
- * @param map the mapping from SQL type names to Java classes
- * @return a java.lang.Object
holding the OUT parameter value
- * @exception SQLException if a database access error occurs
- * @see #setObject
- * @since 1.4
- */
- public Object getObject (String parameterName, java.util.Map map) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC REF(<structured-type>)
- * parameter as a {@link Ref} object in the Java programming language.
- *
- * @param parameterName the name of the parameter
- * @return the parameter value as a Ref
object in the
- * Java programming language. If the value was SQL NULL
,
- * the value null
is returned.
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public Ref getRef (String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC BLOB
parameter as a
- * {@link Blob} object in the Java programming language.
- *
- * @param parameterName the name of the parameter
- * @return the parameter value as a Blob
object in the
- * Java programming language. If the value was SQL NULL
,
- * the value null
is returned.
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public Blob getBlob (String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC CLOB
parameter as a
- * Clob
object in the Java programming language.
- * @param parameterName the name of the parameter
- * @return the parameter value as a Clob
object in the
- * Java programming language. If the value was SQL NULL
,
- * the value null
is returned.
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public Clob getClob (String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC ARRAY
parameter as an
- * {@link Array} object in the Java programming language.
- *
- * @param parameterName the name of the parameter
- * @return the parameter value as an Array
object in
- * Java programming language. If the value was SQL NULL
,
- * the value null
is returned.
- * @exception SQLException if a database access error occurs
- * @since 1.4
- */
- public Array getArray (String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC DATE
parameter as a
- * java.sql.Date
object, using
- * the given Calendar
object
- * to construct the date.
- * With a Calendar
object, the driver
- * can calculate the date taking into account a custom timezone and locale.
- * If no Calendar
object is specified, the driver uses the
- * default timezone and locale.
- *
- * @param parameterName the name of the parameter
- * @param cal the Calendar
object the driver will use
- * to construct the date
- * @return the parameter value. If the value is SQL NULL
,
- * the result is null
.
- * @exception SQLException if a database access error occurs
- * @see #setDate
- * @since 1.4
- */
- public java.sql.Date getDate(String parameterName, Calendar cal)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC TIME
parameter as a
- * java.sql.Time
object, using
- * the given Calendar
object
- * to construct the time.
- * With a Calendar
object, the driver
- * can calculate the time taking into account a custom timezone and locale.
- * If no Calendar
object is specified, the driver uses the
- * default timezone and locale.
- *
- * @param parameterName the name of the parameter
- * @param cal the Calendar
object the driver will use
- * to construct the time
- * @return the parameter value; if the value is SQL NULL
, the result is
- * null
.
- * @exception SQLException if a database access error occurs
- * @see #setTime
- * @since 1.4
- */
- public java.sql.Time getTime(String parameterName, Calendar cal)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC TIMESTAMP
parameter as a
- * java.sql.Timestamp
object, using
- * the given Calendar
object to construct
- * the Timestamp
object.
- * With a Calendar
object, the driver
- * can calculate the timestamp taking into account a custom timezone and locale.
- * If no Calendar
object is specified, the driver uses the
- * default timezone and locale.
- *
- *
- * @param parameterName the name of the parameter
- * @param cal the Calendar
object the driver will use
- * to construct the timestamp
- * @return the parameter value. If the value is SQL NULL
, the result is
- * null
.
- * @exception SQLException if a database access error occurs
- * @see #setTimestamp
- * @since 1.4
- */
- public java.sql.Timestamp getTimestamp(String parameterName, Calendar cal)
- throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
-
- /**
- * Retrieves the value of a JDBC DATALINK
parameter as a
- * java.net.URL
object.
- *
- * @param parameterName the name of the parameter
- * @return the parameter value as a java.net.URL
object in the
- * Java programming language. If the value was SQL NULL
, the
- * value null
is returned.
- * @exception SQLException if a database access error occurs,
- * or if there is a problem with the URL
- * @see #setURL
- * @since 1.4
- */
- public java.net.URL getURL(String parameterName) throws SQLException {
- throw org.postgresql.Driver.notImplemented();
- }
+ /**
+ * Moves to this Statement
object's next result, deals with
+ * any current ResultSet
object(s) according to the instructions
+ * specified by the given flag, and returns
+ * true
if the next result is a ResultSet
object.
+ *
+ *
+ *
+ *
+ * @param current one of the following (!getMoreResults() && (getUpdateCount() == -1)
+ * Statement
+ * constants indicating what should happen to current
+ * ResultSet
objects obtained using the method
+ * getResultSetCLOSE_CURRENT_RESULT
,
+ * KEEP_CURRENT_RESULT
, or
+ * CLOSE_ALL_RESULTS
+ * @return true
if the next result is a ResultSet
+ * object; false
if it is an update count or there are no
+ * more results
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ * @see #execute
+ */
+ public boolean getMoreResults(int current) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves any auto-generated keys created as a result of executing this
+ * Statement
object. If this Statement
object did
+ * not generate any keys, an empty ResultSet
+ * object is returned.
+ *
+ * @return a ResultSet
object containing the auto-generated key(s)
+ * generated by the execution of this Statement
object
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public ResultSet getGeneratedKeys() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Executes the given SQL statement and signals the driver with the
+ * given flag about whether the
+ * auto-generated keys produced by this Statement
object
+ * should be made available for retrieval.
+ *
+ * @param sql must be an SQL INSERT
, UPDATE
or
+ * DELETE
statement or an SQL statement that
+ * returns nothing
+ * @param autoGeneratedKeys a flag indicating whether auto-generated keys
+ * should be made available for retrieval;
+ * one of the following constants:
+ * Statement.RETURN_GENERATED_KEYS
+ * Statement.NO_GENERATED_KEYS
+ * @return either the row count for INSERT
, UPDATE
+ * or DELETE
statements, or 0
for SQL
+ * statements that return nothing
+ * @exception SQLException if a database access error occurs, the given
+ * SQL statement returns a ResultSet
object, or
+ * the given constant is not one of those allowed
+ * @since 1.4
+ */
+ public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Executes the given SQL statement and signals the driver that the
+ * auto-generated keys indicated in the given array should be made available
+ * for retrieval. The driver will ignore the array if the SQL statement
+ * is not an INSERT
statement.
+ *
+ * @param sql an SQL INSERT
, UPDATE
or
+ * DELETE
statement or an SQL statement that returns nothing,
+ * such as an SQL DDL statement
+ * @param columnIndexes an array of column indexes indicating the columns
+ * that should be returned from the inserted row
+ * @return either the row count for INSERT
, UPDATE
,
+ * or DELETE
statements, or 0 for SQL statements
+ * that return nothing
+ * @exception SQLException if a database access error occurs or the SQL
+ * statement returns a ResultSet
object
+ * @since 1.4
+ */
+ public int executeUpdate(String sql, int columnIndexes[]) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Executes the given SQL statement and signals the driver that the
+ * auto-generated keys indicated in the given array should be made available
+ * for retrieval. The driver will ignore the array if the SQL statement
+ * is not an INSERT
statement.
+ *
+ * @param sql an SQL INSERT
, UPDATE
or
+ * DELETE
statement or an SQL statement that returns nothing
+ * @param columnNames an array of the names of the columns that should be
+ * returned from the inserted row
+ * @return either the row count for INSERT
, UPDATE
,
+ * or DELETE
statements, or 0 for SQL statements
+ * that return nothing
+ * @exception SQLException if a database access error occurs
+ *
+ * @since 1.4
+ */
+ public int executeUpdate(String sql, String columnNames[]) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Executes the given SQL statement, which may return multiple results,
+ * and signals the driver that any
+ * auto-generated keys should be made available
+ * for retrieval. The driver will ignore this signal if the SQL statement
+ * is not an INSERT
statement.
+ * execute
method executes an SQL statement and indicates the
+ * form of the first result. You must then use the methods
+ * getResultSet
or getUpdateCount
+ * to retrieve the result, and getMoreResults
to
+ * move to any subsequent result(s).
+ *
+ * @param sql any SQL statement
+ * @param autoGeneratedKeys a constant indicating whether auto-generated
+ * keys should be made available for retrieval using the method
+ * getGeneratedKeys
; one of the following constants:
+ * Statement.RETURN_GENERATED_KEYS
or
+ * Statement.NO_GENERATED_KEYS
+ * @return true
if the first result is a ResultSet
+ * object; false
if it is an update count or there are
+ * no results
+ * @exception SQLException if a database access error occurs
+ * @see #getResultSet
+ * @see #getUpdateCount
+ * @see #getMoreResults
+ * @see #getGeneratedKeys
+ *
+ * @since 1.4
+ */
+ public boolean execute(String sql, int autoGeneratedKeys) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Executes the given SQL statement, which may return multiple results,
+ * and signals the driver that the
+ * auto-generated keys indicated in the given array should be made available
+ * for retrieval. This array contains the indexes of the columns in the
+ * target table that contain the auto-generated keys that should be made
+ * available. The driver will ignore the array if the given SQL statement
+ * is not an INSERT
statement.
+ * execute
method executes an SQL statement and indicates the
+ * form of the first result. You must then use the methods
+ * getResultSet
or getUpdateCount
+ * to retrieve the result, and getMoreResults
to
+ * move to any subsequent result(s).
+ *
+ * @param sql any SQL statement
+ * @param columnIndexes an array of the indexes of the columns in the
+ * inserted row that should be made available for retrieval by a
+ * call to the method getGeneratedKeys
+ * @return true
if the first result is a ResultSet
+ * object; false
if it is an update count or there
+ * are no results
+ * @exception SQLException if a database access error occurs
+ * @see #getResultSet
+ * @see #getUpdateCount
+ * @see #getMoreResults
+ *
+ * @since 1.4
+ */
+ public boolean execute(String sql, int columnIndexes[]) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Executes the given SQL statement, which may return multiple results,
+ * and signals the driver that the
+ * auto-generated keys indicated in the given array should be made available
+ * for retrieval. This array contains the names of the columns in the
+ * target table that contain the auto-generated keys that should be made
+ * available. The driver will ignore the array if the given SQL statement
+ * is not an INSERT
statement.
+ * execute
method executes an SQL statement and indicates the
+ * form of the first result. You must then use the methods
+ * getResultSet
or getUpdateCount
+ * to retrieve the result, and getMoreResults
to
+ * move to any subsequent result(s).
+ *
+ * @param sql any SQL statement
+ * @param columnNames an array of the names of the columns in the inserted
+ * row that should be made available for retrieval by a call to the
+ * method getGeneratedKeys
+ * @return true
if the next result is a ResultSet
+ * object; false
if it is an update count or there
+ * are no more results
+ * @exception SQLException if a database access error occurs
+ * @see #getResultSet
+ * @see #getUpdateCount
+ * @see #getMoreResults
+ * @see #getGeneratedKeys
+ *
+ * @since 1.4
+ */
+ public boolean execute(String sql, String columnNames[]) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the result set holdability for ResultSet
objects
+ * generated by this Statement
object.
+ *
+ * @return either ResultSet.HOLD_CURSORS_OVER_COMMIT
or
+ * ResultSet.CLOSE_CURSORS_AT_COMMIT
+ * @exception SQLException if a database access error occurs
+ *
+ * @since 1.4
+ */
+ public int getResultSetHoldability() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given java.net.URL
value.
+ * The driver converts this to an SQL DATALINK
value
+ * when it sends it to the database.
+ *
+ * @param parameterIndex the first parameter is 1, the second is 2, ...
+ * @param x the java.net.URL
object to be set
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public void setURL(int parameterIndex, java.net.URL x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the number, types and properties of this
+ * PreparedStatement
object's parameters.
+ *
+ * @return a ParameterMetaData
object that contains information
+ * about the number, types and properties of this
+ * PreparedStatement
object's parameters
+ * @exception SQLException if a database access error occurs
+ * @see ParameterMetaData
+ * @since 1.4
+ */
+ public ParameterMetaData getParameterMetaData() throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Registers the OUT parameter named
+ * parameterName
to the JDBC type
+ * sqlType
. All OUT parameters must be registered
+ * before a stored procedure is executed.
+ * sqlType
for an OUT
+ * parameter determines the Java type that must be used
+ * in the get
method to read the value of that parameter.
+ * sqlType
+ * should be java.sql.Types.OTHER
. The method
+ * {@link #getObject} retrieves the value.
+ * @param parameterName the name of the parameter
+ * @param sqlType the JDBC type code defined by java.sql.Types
.
+ * If the parameter is of JDBC type NUMERIC
+ * or DECIMAL
, the version of
+ * registerOutParameter
that accepts a scale value
+ * should be used.
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ * @see Types
+ */
+ public void registerOutParameter(String parameterName, int sqlType)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Registers the parameter named
+ * parameterName
to be of JDBC type
+ * sqlType
. This method must be called
+ * before a stored procedure is executed.
+ * sqlType
for an OUT
+ * parameter determines the Java type that must be used
+ * in the get
method to read the value of that parameter.
+ * registerOutParameter
should be
+ * used when the parameter is of JDBC type NUMERIC
+ * or DECIMAL
.
+ * @param parameterName the name of the parameter
+ * @param sqlType SQL type code defined by java.sql.Types
.
+ * @param scale the desired number of digits to the right of the
+ * decimal point. It must be greater than or equal to zero.
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ * @see Types
+ */
+ public void registerOutParameter(String parameterName, int sqlType, int scale)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Registers the designated output parameter. This version of
+ * the method registerOutParameter
+ * should be used for a user-named or REF output parameter. Examples
+ * of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and
+ * named array types.
+ *
+ * Before executing a stored procedure call, you must explicitly
+ * call registerOutParameter
to register the type from
+ * java.sql.Types
for each
+ * OUT parameter. For a user-named parameter the fully-qualified SQL
+ * type name of the parameter should also be given, while a REF
+ * parameter requires that the fully-qualified type name of the
+ * referenced type be given. A JDBC driver that does not need the
+ * type code and type name information may ignore it. To be portable,
+ * however, applications should always provide these values for
+ * user-named and REF parameters.
+ *
+ * Although it is intended for user-named and REF parameters,
+ * this method may be used to register a parameter of any JDBC type.
+ * If the parameter does not have a user-named or REF type, the
+ * typeName parameter is ignored.
+ *
+ * getXXX
method whose Java type XXX corresponds to the
+ * parameter's registered SQL type.
+ *
+ * @param parameterName the name of the parameter
+ * @param sqlType a value from {@link java.sql.Types}
+ * @param typeName the fully-qualified name of an SQL structured type
+ * @exception SQLException if a database access error occurs
+ * @see Types
+ * @since 1.4
+ */
+ public void registerOutParameter (String parameterName, int sqlType, String typeName)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of the designated JDBC DATALINK
parameter as a
+ * java.net.URL
object.
+ *
+ * @param parameterIndex the first parameter is 1, the second is 2,...
+ * @return a java.net.URL
object that represents the
+ * JDBC DATALINK
value used as the designated
+ * parameter
+ * @exception SQLException if a database access error occurs,
+ * or if the URL being returned is
+ * not a valid URL on the Java platform
+ * @see #setURL
+ * @since 1.4
+ */
+ public java.net.URL getURL(int parameterIndex) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given java.net.URL
object.
+ * The driver converts this to an SQL DATALINK
value when
+ * it sends it to the database.
+ *
+ * @param parameterName the name of the parameter
+ * @param val the parameter value
+ * @exception SQLException if a database access error occurs,
+ * or if a URL is malformed
+ * @see #getURL
+ * @since 1.4
+ */
+ public void setURL(String parameterName, java.net.URL val) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to SQL NULL
.
+ *
+ * java.sql.Types
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public void setNull(String parameterName, int sqlType) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given Java boolean
value.
+ * The driver converts this
+ * to an SQL BIT
value when it sends it to the database.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @exception SQLException if a database access error occurs
+ * @see #getBoolean
+ * @since 1.4
+ */
+ public void setBoolean(String parameterName, boolean x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given Java byte
value.
+ * The driver converts this
+ * to an SQL TINYINT
value when it sends it to the database.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @exception SQLException if a database access error occurs
+ * @see #getByte
+ * @since 1.4
+ */
+ public void setByte(String parameterName, byte x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given Java short
value.
+ * The driver converts this
+ * to an SQL SMALLINT
value when it sends it to the database.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @exception SQLException if a database access error occurs
+ * @see #getShort
+ * @since 1.4
+ */
+ public void setShort(String parameterName, short x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given Java int
value.
+ * The driver converts this
+ * to an SQL INTEGER
value when it sends it to the database.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @exception SQLException if a database access error occurs
+ * @see #getInt
+ * @since 1.4
+ */
+ public void setInt(String parameterName, int x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given Java long
value.
+ * The driver converts this
+ * to an SQL BIGINT
value when it sends it to the database.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @exception SQLException if a database access error occurs
+ * @see #getLong
+ * @since 1.4
+ */
+ public void setLong(String parameterName, long x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given Java float
value.
+ * The driver converts this
+ * to an SQL FLOAT
value when it sends it to the database.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @exception SQLException if a database access error occurs
+ * @see #getFloat
+ * @since 1.4
+ */
+ public void setFloat(String parameterName, float x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given Java double
value.
+ * The driver converts this
+ * to an SQL DOUBLE
value when it sends it to the database.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @exception SQLException if a database access error occurs
+ * @see #getDouble
+ * @since 1.4
+ */
+ public void setDouble(String parameterName, double x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given
+ * java.math.BigDecimal
value.
+ * The driver converts this to an SQL NUMERIC
value when
+ * it sends it to the database.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @exception SQLException if a database access error occurs
+ * @see #getBigDecimal
+ * @since 1.4
+ */
+ public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given Java String
value.
+ * The driver converts this
+ * to an SQL VARCHAR
or LONGVARCHAR
value
+ * (depending on the argument's
+ * size relative to the driver's limits on VARCHAR
values)
+ * when it sends it to the database.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @exception SQLException if a database access error occurs
+ * @see #getString
+ * @since 1.4
+ */
+ public void setString(String parameterName, String x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given Java array of bytes.
+ * The driver converts this to an SQL VARBINARY
or
+ * LONGVARBINARY
(depending on the argument's size relative
+ * to the driver's limits on VARBINARY
values) when it sends
+ * it to the database.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @exception SQLException if a database access error occurs
+ * @see #getBytes
+ * @since 1.4
+ */
+ public void setBytes(String parameterName, byte x[]) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given java.sql.Date
value.
+ * The driver converts this
+ * to an SQL DATE
value when it sends it to the database.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @exception SQLException if a database access error occurs
+ * @see #getDate
+ * @since 1.4
+ */
+ public void setDate(String parameterName, java.sql.Date x)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given java.sql.Time
value.
+ * The driver converts this
+ * to an SQL TIME
value when it sends it to the database.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @exception SQLException if a database access error occurs
+ * @see #getTime
+ * @since 1.4
+ */
+ public void setTime(String parameterName, java.sql.Time x)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given java.sql.Timestamp
value.
+ * The driver
+ * converts this to an SQL TIMESTAMP
value when it sends it to the
+ * database.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @exception SQLException if a database access error occurs
+ * @see #getTimestamp
+ * @since 1.4
+ */
+ public void setTimestamp(String parameterName, java.sql.Timestamp x)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given input stream, which will have
+ * the specified number of bytes.
+ * 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
. Data will be read from the stream
+ * as needed until end-of-file is reached. The JDBC driver will
+ * do any necessary conversion from ASCII to the database char format.
+ *
+ * LONGVARBINARY
+ * parameter, it may be more practical to send it via a
+ * java.io.InputStream
object. The data will be read from the stream
+ * as needed until end-of-file is reached.
+ *
+ * java.lang
equivalent objects should be used.
+ *
+ * SQLData
),
+ * the JDBC driver should call the method SQLData.writeSQL
to write it
+ * to the SQL data stream.
+ * If, on the other hand, the object is of a class implementing
+ * Ref
, Blob
, Clob
, Struct
,
+ * or Array
, the driver should pass it to the database as a
+ * value of the corresponding SQL type.
+ * setObject
+ * above, except that it assumes a scale of zero.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the object containing the input parameter value
+ * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
+ * sent to the database
+ * @exception SQLException if a database access error occurs
+ * @see #getObject
+ * @since 1.4
+ */
+ public void setObject(String parameterName, Object x, int targetSqlType)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the value of the designated parameter with the given object.
+ * The second parameter must be of type Object
; therefore, the
+ * java.lang
equivalent objects should be used for built-in types.
+ *
+ * Object
types to SQL types. The given argument
+ * will be converted to the corresponding SQL type before being
+ * sent to the database.
+ *
+ * SQLData
,
+ * the JDBC driver should call the method SQLData.writeSQL
+ * to write it to the SQL data stream.
+ * If, on the other hand, the object is of a class implementing
+ * Ref
, Blob
, Clob
, Struct
,
+ * or Array
, the driver should pass it to the database as a
+ * value of the corresponding SQL type.
+ * Object
parameter is ambiguous
+ * @see #getObject
+ * @since 1.4
+ */
+ public void setObject(String parameterName, Object x) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+
+ /**
+ * Sets the designated parameter to the given Reader
+ * object, which is the given number of characters long.
+ * When a very large UNICODE value is input to a LONGVARCHAR
+ * parameter, it may be more practical to send it via a
+ * java.io.Reader
object. The data will be read from the stream
+ * as needed until end-of-file is reached. The JDBC driver will
+ * do any necessary conversion from UNICODE to the database char format.
+ *
+ * java.io.Reader
object that
+ * contains the UNICODE data used as the designated parameter
+ * @param length the number of characters in the stream
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public void setCharacterStream(String parameterName,
+ java.io.Reader reader,
+ int length) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given java.sql.Date
value,
+ * using the given Calendar
object. The driver uses
+ * the Calendar
object to construct an SQL DATE
value,
+ * which the driver then sends to the database. With a
+ * a Calendar
object, the driver can calculate the date
+ * taking into account a custom timezone. If no
+ * Calendar
object is specified, the driver uses the default
+ * timezone, which is that of the virtual machine running the application.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @param cal the Calendar
object the driver will use
+ * to construct the date
+ * @exception SQLException if a database access error occurs
+ * @see #getDate
+ * @since 1.4
+ */
+ public void setDate(String parameterName, java.sql.Date x, Calendar cal)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given java.sql.Time
value,
+ * using the given Calendar
object. The driver uses
+ * the Calendar
object to construct an SQL TIME
value,
+ * which the driver then sends to the database. With a
+ * a Calendar
object, the driver can calculate the time
+ * taking into account a custom timezone. If no
+ * Calendar
object is specified, the driver uses the default
+ * timezone, which is that of the virtual machine running the application.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @param cal the Calendar
object the driver will use
+ * to construct the time
+ * @exception SQLException if a database access error occurs
+ * @see #getTime
+ * @since 1.4
+ */
+ public void setTime(String parameterName, java.sql.Time x, Calendar cal)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to the given java.sql.Timestamp
value,
+ * using the given Calendar
object. The driver uses
+ * the Calendar
object to construct an SQL TIMESTAMP
value,
+ * which the driver then sends to the database. With a
+ * a Calendar
object, the driver can calculate the timestamp
+ * taking into account a custom timezone. If no
+ * Calendar
object is specified, the driver uses the default
+ * timezone, which is that of the virtual machine running the application.
+ *
+ * @param parameterName the name of the parameter
+ * @param x the parameter value
+ * @param cal the Calendar
object the driver will use
+ * to construct the timestamp
+ * @exception SQLException if a database access error occurs
+ * @see #getTimestamp
+ * @since 1.4
+ */
+ public void setTimestamp(String parameterName, java.sql.Timestamp x, Calendar cal)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Sets the designated parameter to SQL NULL
.
+ * This version of the method setNull
should
+ * be used for user-defined types and REF type parameters. Examples
+ * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and
+ * named array types.
+ *
+ * java.sql.Types
+ * @param typeName the fully-qualified name of an SQL user-defined type;
+ * ignored if the parameter is not a user-defined type or
+ * SQL REF
value
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public void setNull (String parameterName, int sqlType, String typeName)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC CHAR
, VARCHAR
,
+ * or LONGVARCHAR
parameter as a String
in
+ * the Java programming language.
+ * CHAR
,
+ * the String
object
+ * returned has exactly the same value the JDBC
+ * CHAR
value had in the
+ * database, including any padding added by the database.
+ * @param parameterName the name of the parameter
+ * @return the parameter value. If the value is SQL NULL
, the result
+ * is null
.
+ * @exception SQLException if a database access error occurs
+ * @see #setString
+ * @since 1.4
+ */
+ public String getString(String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC BIT
parameter as a
+ * boolean
in the Java programming language.
+ * @param parameterName the name of the parameter
+ * @return the parameter value. If the value is SQL NULL
, the result
+ * is false
.
+ * @exception SQLException if a database access error occurs
+ * @see #setBoolean
+ * @since 1.4
+ */
+ public boolean getBoolean(String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC TINYINT
parameter as a byte
+ * in the Java programming language.
+ * @param parameterName the name of the parameter
+ * @return the parameter value. If the value is SQL NULL
, the result
+ * is 0
.
+ * @exception SQLException if a database access error occurs
+ * @see #setByte
+ * @since 1.4
+ */
+ public byte getByte(String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC SMALLINT
parameter as a short
+ * in the Java programming language.
+ * @param parameterName the name of the parameter
+ * @return the parameter value. If the value is SQL NULL
, the result
+ * is 0
.
+ * @exception SQLException if a database access error occurs
+ * @see #setShort
+ * @since 1.4
+ */
+ public short getShort(String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC INTEGER
parameter as an int
+ * in the Java programming language.
+ *
+ * @param parameterName the name of the parameter
+ * @return the parameter value. If the value is SQL NULL
,
+ * the result is 0
.
+ * @exception SQLException if a database access error occurs
+ * @see #setInt
+ * @since 1.4
+ */
+ public int getInt(String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC BIGINT
parameter as a long
+ * in the Java programming language.
+ *
+ * @param parameterName the name of the parameter
+ * @return the parameter value. If the value is SQL NULL
,
+ * the result is 0
.
+ * @exception SQLException if a database access error occurs
+ * @see #setLong
+ * @since 1.4
+ */
+ public long getLong(String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC FLOAT
parameter as a float
+ * in the Java programming language.
+ * @param parameterName the name of the parameter
+ * @return the parameter value. If the value is SQL NULL
,
+ * the result is 0
.
+ * @exception SQLException if a database access error occurs
+ * @see #setFloat
+ * @since 1.4
+ */
+ public float getFloat(String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC DOUBLE
parameter as a double
+ * in the Java programming language.
+ * @param parameterName the name of the parameter
+ * @return the parameter value. If the value is SQL NULL
,
+ * the result is 0
.
+ * @exception SQLException if a database access error occurs
+ * @see #setDouble
+ * @since 1.4
+ */
+ public double getDouble(String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC BINARY
or VARBINARY
+ * parameter as an array of byte
values in the Java
+ * programming language.
+ * @param parameterName the name of the parameter
+ * @return the parameter value. If the value is SQL NULL
, the result is
+ * null
.
+ * @exception SQLException if a database access error occurs
+ * @see #setBytes
+ * @since 1.4
+ */
+ public byte[] getBytes(String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC DATE
parameter as a
+ * java.sql.Date
object.
+ * @param parameterName the name of the parameter
+ * @return the parameter value. If the value is SQL NULL
, the result
+ * is null
.
+ * @exception SQLException if a database access error occurs
+ * @see #setDate
+ * @since 1.4
+ */
+ public java.sql.Date getDate(String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC TIME
parameter as a
+ * java.sql.Time
object.
+ * @param parameterName the name of the parameter
+ * @return the parameter value. If the value is SQL NULL
, the result
+ * is null
.
+ * @exception SQLException if a database access error occurs
+ * @see #setTime
+ * @since 1.4
+ */
+ public java.sql.Time getTime(String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC TIMESTAMP
parameter as a
+ * java.sql.Timestamp
object.
+ * @param parameterName the name of the parameter
+ * @return the parameter value. If the value is SQL NULL
, the result
+ * is null
.
+ * @exception SQLException if a database access error occurs
+ * @see #setTimestamp
+ * @since 1.4
+ */
+ public java.sql.Timestamp getTimestamp(String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a parameter as an Object
in the Java
+ * programming language. If the value is an SQL NULL
, the
+ * driver returns a Java null
.
+ * registerOutParameter
. By registering the target JDBC
+ * type as java.sql.Types.OTHER
, this method can be used
+ * to read database-specific abstract data types.
+ * @param parameterName the name of the parameter
+ * @return A java.lang.Object
holding the OUT parameter value.
+ * @exception SQLException if a database access error occurs
+ * @see Types
+ * @see #setObject
+ * @since 1.4
+ */
+ public Object getObject(String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC NUMERIC
parameter as a
+ * java.math.BigDecimal
object with as many digits to the
+ * right of the decimal point as the value contains.
+ * @param parameterName the name of the parameter
+ * @return the parameter value in full precision. If the value is
+ * SQL NULL
, the result is null
.
+ * @exception SQLException if a database access error occurs
+ * @see #setBigDecimal
+ * @since 1.4
+ */
+ public BigDecimal getBigDecimal(String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Returns an object representing the value of OUT parameter
+ * i
and uses map
for the custom
+ * mapping of the parameter value.
+ * registerOutParameter
. By registering the target
+ * JDBC type as java.sql.Types.OTHER
, this method can
+ * be used to read database-specific abstract data types.
+ * @param parameterName the name of the parameter
+ * @param map the mapping from SQL type names to Java classes
+ * @return a java.lang.Object
holding the OUT parameter value
+ * @exception SQLException if a database access error occurs
+ * @see #setObject
+ * @since 1.4
+ */
+ public Object getObject (String parameterName, java.util.Map map) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC REF(<structured-type>)
+ * parameter as a {@link Ref} object in the Java programming language.
+ *
+ * @param parameterName the name of the parameter
+ * @return the parameter value as a Ref
object in the
+ * Java programming language. If the value was SQL NULL
,
+ * the value null
is returned.
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public Ref getRef (String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC BLOB
parameter as a
+ * {@link Blob} object in the Java programming language.
+ *
+ * @param parameterName the name of the parameter
+ * @return the parameter value as a Blob
object in the
+ * Java programming language. If the value was SQL NULL
,
+ * the value null
is returned.
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public Blob getBlob (String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC CLOB
parameter as a
+ * Clob
object in the Java programming language.
+ * @param parameterName the name of the parameter
+ * @return the parameter value as a Clob
object in the
+ * Java programming language. If the value was SQL NULL
,
+ * the value null
is returned.
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public Clob getClob (String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC ARRAY
parameter as an
+ * {@link Array} object in the Java programming language.
+ *
+ * @param parameterName the name of the parameter
+ * @return the parameter value as an Array
object in
+ * Java programming language. If the value was SQL NULL
,
+ * the value null
is returned.
+ * @exception SQLException if a database access error occurs
+ * @since 1.4
+ */
+ public Array getArray (String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC DATE
parameter as a
+ * java.sql.Date
object, using
+ * the given Calendar
object
+ * to construct the date.
+ * With a Calendar
object, the driver
+ * can calculate the date taking into account a custom timezone and locale.
+ * If no Calendar
object is specified, the driver uses the
+ * default timezone and locale.
+ *
+ * @param parameterName the name of the parameter
+ * @param cal the Calendar
object the driver will use
+ * to construct the date
+ * @return the parameter value. If the value is SQL NULL
,
+ * the result is null
.
+ * @exception SQLException if a database access error occurs
+ * @see #setDate
+ * @since 1.4
+ */
+ public java.sql.Date getDate(String parameterName, Calendar cal)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC TIME
parameter as a
+ * java.sql.Time
object, using
+ * the given Calendar
object
+ * to construct the time.
+ * With a Calendar
object, the driver
+ * can calculate the time taking into account a custom timezone and locale.
+ * If no Calendar
object is specified, the driver uses the
+ * default timezone and locale.
+ *
+ * @param parameterName the name of the parameter
+ * @param cal the Calendar
object the driver will use
+ * to construct the time
+ * @return the parameter value; if the value is SQL NULL
, the result is
+ * null
.
+ * @exception SQLException if a database access error occurs
+ * @see #setTime
+ * @since 1.4
+ */
+ public java.sql.Time getTime(String parameterName, Calendar cal)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC TIMESTAMP
parameter as a
+ * java.sql.Timestamp
object, using
+ * the given Calendar
object to construct
+ * the Timestamp
object.
+ * With a Calendar
object, the driver
+ * can calculate the timestamp taking into account a custom timezone and locale.
+ * If no Calendar
object is specified, the driver uses the
+ * default timezone and locale.
+ *
+ *
+ * @param parameterName the name of the parameter
+ * @param cal the Calendar
object the driver will use
+ * to construct the timestamp
+ * @return the parameter value. If the value is SQL NULL
, the result is
+ * null
.
+ * @exception SQLException if a database access error occurs
+ * @see #setTimestamp
+ * @since 1.4
+ */
+ public java.sql.Timestamp getTimestamp(String parameterName, Calendar cal)
+ throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /**
+ * Retrieves the value of a JDBC DATALINK
parameter as a
+ * java.net.URL
object.
+ *
+ * @param parameterName the name of the parameter
+ * @return the parameter value as a java.net.URL
object in the
+ * Java programming language. If the value was SQL NULL
, the
+ * value null
is returned.
+ * @exception SQLException if a database access error occurs,
+ * or if there is a problem with the URL
+ * @see #setURL
+ * @since 1.4
+ */
+ public java.net.URL getURL(String parameterName) throws SQLException
+ {
+ throw org.postgresql.Driver.notImplemented();
+ }
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3CallableStatement.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3CallableStatement.java
index eef5bd4fbc679e583b5799960cdc4fcfb0361ca6..64b2be2d41f74a1080e9d49a656345649980f5da 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3CallableStatement.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3CallableStatement.java
@@ -5,11 +5,11 @@ import java.sql.*;
public class Jdbc3CallableStatement extends org.postgresql.jdbc3.AbstractJdbc3Statement implements java.sql.CallableStatement
{
-
+
public Jdbc3CallableStatement(Jdbc3Connection connection, String sql) throws SQLException
{
super(connection, sql);
}
-
+
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Connection.java
index b6f279d7e23acb1144293c73a6a543ddcf518dfd..2e1ba7d8cbf78e05bf4008e9315cc6150338aaa0 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Connection.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Connection.java
@@ -6,56 +6,56 @@ import java.util.Vector;
import java.util.Hashtable;
import org.postgresql.Field;
-/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3Connection.java,v 1.1 2002/08/14 20:35:40 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3Connection.java,v 1.2 2002/09/06 21:23:06 momjian Exp $
* This class implements the java.sql.Connection interface for JDBC3.
- * However most of the implementation is really done in
+ * However most of the implementation is really done in
* org.postgresql.jdbc3.AbstractJdbc3Connection or one of it's parents
*/
public class Jdbc3Connection extends org.postgresql.jdbc3.AbstractJdbc3Connection implements java.sql.Connection
{
-
- public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
- {
- Jdbc3Statement s = new Jdbc3Statement(this);
- s.setResultSetType(resultSetType);
- s.setResultSetConcurrency(resultSetConcurrency);
- return s;
- }
-
-
- public java.sql.PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
- {
- Jdbc3PreparedStatement s = new Jdbc3PreparedStatement(this, sql);
- s.setResultSetType(resultSetType);
- s.setResultSetConcurrency(resultSetConcurrency);
- return s;
- }
-
- public java.sql.CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
- {
- Jdbc3CallableStatement s = new Jdbc3CallableStatement(this,sql);
+
+ public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
+ {
+ Jdbc3Statement s = new Jdbc3Statement(this);
+ s.setResultSetType(resultSetType);
+ s.setResultSetConcurrency(resultSetConcurrency);
+ return s;
+ }
+
+
+ public java.sql.PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
+ {
+ Jdbc3PreparedStatement s = new Jdbc3PreparedStatement(this, sql);
s.setResultSetType(resultSetType);
- s.setResultSetConcurrency(resultSetConcurrency);
- return s;
- }
-
- public java.sql.DatabaseMetaData getMetaData() throws SQLException
- {
- if (metadata == null)
- metadata = new Jdbc3DatabaseMetaData(this);
- return metadata;
- }
-
- public java.sql.ResultSet getResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
- {
- return new Jdbc3ResultSet(this, statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
- }
-
- public java.sql.ResultSet getResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount) throws SQLException
- {
- return new Jdbc3ResultSet(this, statement, fields, tuples, status, updateCount, 0, false);
- }
-
+ s.setResultSetConcurrency(resultSetConcurrency);
+ return s;
+ }
+
+ public java.sql.CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
+ {
+ Jdbc3CallableStatement s = new Jdbc3CallableStatement(this, sql);
+ s.setResultSetType(resultSetType);
+ s.setResultSetConcurrency(resultSetConcurrency);
+ return s;
+ }
+
+ public java.sql.DatabaseMetaData getMetaData() throws SQLException
+ {
+ if (metadata == null)
+ metadata = new Jdbc3DatabaseMetaData(this);
+ return metadata;
+ }
+
+ public java.sql.ResultSet getResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
+ {
+ return new Jdbc3ResultSet(this, statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
+ }
+
+ public java.sql.ResultSet getResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount) throws SQLException
+ {
+ return new Jdbc3ResultSet(this, statement, fields, tuples, status, updateCount, 0, false);
+ }
+
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3DatabaseMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3DatabaseMetaData.java
index c242c6322837d135b6d34715c2a10079d0b85229..24fe763073018be451b32068b7c9095d02596ee3 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3DatabaseMetaData.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3DatabaseMetaData.java
@@ -3,10 +3,10 @@ package org.postgresql.jdbc3;
public class Jdbc3DatabaseMetaData extends org.postgresql.jdbc3.AbstractJdbc3DatabaseMetaData implements java.sql.DatabaseMetaData
{
-
+
public Jdbc3DatabaseMetaData(Jdbc3Connection conn)
{
super(conn);
}
-
+
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3PreparedStatement.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3PreparedStatement.java
index bc570129ebdddc72aa6acf1640d39f410849f2f5..85ccbbb5e89955994f52ad23f673c99e1a72b566 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3PreparedStatement.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3PreparedStatement.java
@@ -5,11 +5,11 @@ import java.sql.*;
public class Jdbc3PreparedStatement extends org.postgresql.jdbc3.AbstractJdbc3Statement implements java.sql.PreparedStatement
{
-
+
public Jdbc3PreparedStatement(Jdbc3Connection connection, String sql) throws SQLException
{
super(connection, sql);
}
-
+
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java
index f2652ee1f5a2982a6e2a9a4291971672e5cf281d..c988127fe46519a350f9d4aa4527a3f26655b1e0 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java
@@ -5,31 +5,33 @@ import java.sql.*;
import java.util.Vector;
import org.postgresql.Field;
-/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3ResultSet.java,v 1.1 2002/08/14 20:35:40 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3ResultSet.java,v 1.2 2002/09/06 21:23:06 momjian Exp $
* This class implements the java.sql.ResultSet interface for JDBC3.
- * However most of the implementation is really done in
+ * However most of the implementation is really done in
* org.postgresql.jdbc3.AbstractJdbc3ResultSet or one of it's parents
*/
public class Jdbc3ResultSet extends org.postgresql.jdbc3.AbstractJdbc3ResultSet implements java.sql.ResultSet
{
-
+
public Jdbc3ResultSet(Jdbc3Connection conn, Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
{
super(conn, statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
-
+
public java.sql.ResultSetMetaData getMetaData() throws SQLException
{
return new Jdbc3ResultSetMetaData(rows, fields);
}
-
- public java.sql.Clob getClob(int i) throws SQLException {
- return new Jdbc3Clob(connection, getInt(i));
- }
-
- public java.sql.Blob getBlob(int i) throws SQLException {
- return new Jdbc3Blob(connection, getInt(i));
- }
+
+ public java.sql.Clob getClob(int i) throws SQLException
+ {
+ return new Jdbc3Clob(connection, getInt(i));
+ }
+
+ public java.sql.Blob getBlob(int i) throws SQLException
+ {
+ return new Jdbc3Blob(connection, getInt(i));
+ }
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSetMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSetMetaData.java
index 5dd48a9846334a30cc5442b3b6d8fdfe24ca98fb..cc49aadd58df6720df390df08efa117c5b9de3b6 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSetMetaData.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSetMetaData.java
@@ -2,11 +2,11 @@ package org.postgresql.jdbc3;
public class Jdbc3ResultSetMetaData extends org.postgresql.jdbc2.AbstractJdbc2ResultSetMetaData implements java.sql.ResultSetMetaData
{
-
+
public Jdbc3ResultSetMetaData(java.util.Vector rows, org.postgresql.Field[] fields)
{
- super(rows, fields);
+ super(rows, fields);
}
-
+
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Statement.java
index bf6a0d5155ac43a4f964ea350f479c81c4e57f71..c711b11696b59a9428cc8d3864fd98b92bdb5e8b 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Statement.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Statement.java
@@ -3,17 +3,17 @@ package org.postgresql.jdbc3;
import java.sql.*;
-/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3Statement.java,v 1.1 2002/08/14 20:35:40 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3Statement.java,v 1.2 2002/09/06 21:23:06 momjian Exp $
* This class implements the java.sql.Statement interface for JDBC3.
- * However most of the implementation is really done in
+ * However most of the implementation is really done in
* org.postgresql.jdbc3.AbstractJdbc3Statement or one of it's parents
*/
public class Jdbc3Statement extends org.postgresql.jdbc3.AbstractJdbc3Statement implements java.sql.Statement
{
-
+
public Jdbc3Statement (Jdbc3Connection c)
{
super(c);
}
-
+
}
diff --git a/src/interfaces/jdbc/org/postgresql/largeobject/LargeObject.java b/src/interfaces/jdbc/org/postgresql/largeobject/LargeObject.java
index 5910482bffce5cb31307738c7cb092ae6312d8a9..316716e42d0964386a482410fc06b288369b24b0 100644
--- a/src/interfaces/jdbc/org/postgresql/largeobject/LargeObject.java
+++ b/src/interfaces/jdbc/org/postgresql/largeobject/LargeObject.java
@@ -92,12 +92,12 @@ public class LargeObject
/* Release large object resources during garbage cleanup */
protected void finalize() throws SQLException
{
- //This code used to call close() however that was problematic
- //because the scope of the fd is a transaction, thus if commit
- //or rollback was called before garbage collection ran then
- //the call to close would error out with an invalid large object
- //handle. So this method now does nothing and lets the server
- //handle cleanup when it ends the transaction.
+ //This code used to call close() however that was problematic
+ //because the scope of the fd is a transaction, thus if commit
+ //or rollback was called before garbage collection ran then
+ //the call to close would error out with an invalid large object
+ //handle. So this method now does nothing and lets the server
+ //handle cleanup when it ends the transaction.
}
/*
diff --git a/src/interfaces/jdbc/org/postgresql/largeobject/LargeObjectManager.java b/src/interfaces/jdbc/org/postgresql/largeobject/LargeObjectManager.java
index a037ab28a21719cc183e5fc246badf38d06341dc..a57c01cd232cc26acfd05710567fa02d2de02287 100644
--- a/src/interfaces/jdbc/org/postgresql/largeobject/LargeObjectManager.java
+++ b/src/interfaces/jdbc/org/postgresql/largeobject/LargeObjectManager.java
@@ -104,21 +104,22 @@ public class LargeObjectManager
// This is an example of Fastpath.addFunctions();
//
ResultSet res = conn.createStatement().executeQuery("select proname, oid from pg_proc" +
- " where proname = 'lo_open'" +
- " or proname = 'lo_close'" +
- " or proname = 'lo_creat'" +
- " or proname = 'lo_unlink'" +
- " or proname = 'lo_lseek'" +
- " or proname = 'lo_tell'" +
- " or proname = 'loread'" +
- " or proname = 'lowrite'");
+ " where proname = 'lo_open'" +
+ " or proname = 'lo_close'" +
+ " or proname = 'lo_creat'" +
+ " or proname = 'lo_unlink'" +
+ " or proname = 'lo_lseek'" +
+ " or proname = 'lo_tell'" +
+ " or proname = 'loread'" +
+ " or proname = 'lowrite'");
if (res == null)
throw new PSQLException("postgresql.lo.init");
fp.addFunctions(res);
res.close();
- if (Driver.logDebug) Driver.debug("Large Object initialised");
+ if (Driver.logDebug)
+ Driver.debug("Large Object initialised");
}
/*
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/CallableStmtTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/CallableStmtTest.java
index 23cc28697f7cd2b4c3bd08d1205c77b764496ab6..eb05fa97ab8f1c9e9d4142ced8d84148f1b7d3dd 100644
--- a/src/interfaces/jdbc/org/postgresql/test/jdbc2/CallableStmtTest.java
+++ b/src/interfaces/jdbc/org/postgresql/test/jdbc2/CallableStmtTest.java
@@ -22,17 +22,17 @@ public class CallableStmtTest extends TestCase
{
con = TestUtil.openDB();
Statement stmt = con.createStatement ();
- stmt.execute ("CREATE OR REPLACE FUNCTION testspg__getString (varchar) " +
- "RETURNS varchar AS ' DECLARE inString alias for $1; begin "+
+ stmt.execute ("CREATE OR REPLACE FUNCTION testspg__getString (varchar) " +
+ "RETURNS varchar AS ' DECLARE inString alias for $1; begin " +
"return ''bob''; end; ' LANGUAGE 'plpgsql';");
- stmt.execute ("CREATE OR REPLACE FUNCTION testspg__getDouble (float) " +
+ stmt.execute ("CREATE OR REPLACE FUNCTION testspg__getDouble (float) " +
"RETURNS float AS ' DECLARE inString alias for $1; begin " +
"return 42.42; end; ' LANGUAGE 'plpgsql';");
stmt.execute ("CREATE OR REPLACE FUNCTION testspg__getInt (int) RETURNS int " +
- " AS 'DECLARE inString alias for $1; begin " +
- "return 42; end;' LANGUAGE 'plpgsql';");
- stmt.execute ("CREATE OR REPLACE FUNCTION testspg__getNumeric (numeric) " +
- "RETURNS numeric AS ' DECLARE inString alias for $1; " +
+ " AS 'DECLARE inString alias for $1; begin " +
+ "return 42; end;' LANGUAGE 'plpgsql';");
+ stmt.execute ("CREATE OR REPLACE FUNCTION testspg__getNumeric (numeric) " +
+ "RETURNS numeric AS ' DECLARE inString alias for $1; " +
"begin return 42; end; ' LANGUAGE 'plpgsql';");
stmt.close ();
}
@@ -54,7 +54,8 @@ public class CallableStmtTest extends TestCase
//testGetString ();
//}
- public void testGetDouble () throws Throwable {
+ public void testGetDouble () throws Throwable
+ {
// System.out.println ("Testing CallableStmt Types.DOUBLE");
CallableStatement call = con.prepareCall (func + pkgName + "getDouble (?) }");
call.setDouble (2, (double)3.04);
@@ -64,7 +65,8 @@ public class CallableStmtTest extends TestCase
assertTrue ("correct return from getString ()", result == 42.42);
}
- public void testGetInt () throws Throwable {
+ public void testGetInt () throws Throwable
+ {
// System.out.println ("Testing CallableStmt Types.INTEGER");
CallableStatement call = con.prepareCall (func + pkgName + "getInt (?) }");
call.setInt (2, 4);
@@ -74,18 +76,20 @@ public class CallableStmtTest extends TestCase
assertTrue ("correct return from getString ()", result == 42);
}
- public void testGetNumeric () throws Throwable {
+ public void testGetNumeric () throws Throwable
+ {
// System.out.println ("Testing CallableStmt Types.NUMERIC");
CallableStatement call = con.prepareCall (func + pkgName + "getNumeric (?) }");
call.setBigDecimal (2, new java.math.BigDecimal(4));
call.registerOutParameter (1, Types.NUMERIC);
call.execute ();
java.math.BigDecimal result = call.getBigDecimal (1);
- assertTrue ("correct return from getString ()",
+ assertTrue ("correct return from getString ()",
result.equals (new java.math.BigDecimal(42)));
}
- public void testGetString () throws Throwable {
+ public void testGetString () throws Throwable
+ {
// System.out.println ("Testing CallableStmt Types.VARCHAR");
CallableStatement call = con.prepareCall (func + pkgName + "getString (?) }");
call.setString (2, "foo");
@@ -96,20 +100,25 @@ public class CallableStmtTest extends TestCase
}
- public void testBadStmt () throws Throwable {
+ public void testBadStmt () throws Throwable
+ {
tryOneBadStmt ("{ ?= " + pkgName + "getString (?) }");
tryOneBadStmt ("{ ?= call getString (?) ");
tryOneBadStmt ("{ = ? call getString (?); }");
}
- protected void tryOneBadStmt (String sql) throws Throwable {
+ protected void tryOneBadStmt (String sql) throws Throwable
+ {
boolean wasCaught = false;
- try {
+ try
+ {
CallableStatement call = con.prepareCall (sql);
- } catch (SQLException e) {
+ }
+ catch (SQLException e)
+ {
wasCaught = true; // good -> this statement was missing something
}
- assertTrue ("bad statment ('"+sql+"')was not caught", wasCaught);
+ assertTrue ("bad statment ('" + sql + "')was not caught", wasCaught);
}
-
+
}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
index cb7d036a77f9a0827754451ee7d59665fc5028c6..87341925c5d5b99991a6baba45daf8eaff1a480f 100644
--- a/src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
+++ b/src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
@@ -9,7 +9,7 @@ import java.sql.*;
*
* PS: Do you know how difficult it is to type on a train? ;-)
*
- * $Id: DatabaseMetaDataTest.java,v 1.12 2002/08/23 20:45:49 barry Exp $
+ * $Id: DatabaseMetaDataTest.java,v 1.13 2002/09/06 21:23:06 momjian Exp $
*/
public class DatabaseMetaDataTest extends TestCase
@@ -48,7 +48,7 @@ public class DatabaseMetaDataTest extends TestCase
ResultSet rs = dbmd.getTables( null, null, "test%", new String[] {"TABLE"});
assertTrue( rs.next() );
- String tableName = rs.getString("TABLE_NAME");
+ String tableName = rs.getString("TABLE_NAME");
assertTrue( tableName.equals("testmetadata") );
rs.close();
@@ -102,10 +102,10 @@ public class DatabaseMetaDataTest extends TestCase
assertTrue(dbmd.supportsMinimumSQLGrammar());
assertTrue(!dbmd.supportsCoreSQLGrammar());
assertTrue(!dbmd.supportsExtendedSQLGrammar());
- if (((org.postgresql.jdbc1.AbstractJdbc1Connection)con).haveMinimumServerVersion("7.3"))
- assertTrue(dbmd.supportsANSI92EntryLevelSQL());
- else
- assertTrue(!dbmd.supportsANSI92EntryLevelSQL());
+ if (((org.postgresql.jdbc1.AbstractJdbc1Connection)con).haveMinimumServerVersion("7.3"))
+ assertTrue(dbmd.supportsANSI92EntryLevelSQL());
+ else
+ assertTrue(!dbmd.supportsANSI92EntryLevelSQL());
assertTrue(!dbmd.supportsANSI92IntermediateSQL());
assertTrue(!dbmd.supportsANSI92FullSQL());
@@ -232,124 +232,124 @@ public class DatabaseMetaDataTest extends TestCase
}
}
- public void testCrossReference()
- {
+ public void testCrossReference()
+ {
try
{
- Connection con1 = TestUtil.openDB();
+ Connection con1 = TestUtil.openDB();
- TestUtil.createTable( con1, "vv", "a int not null, b int not null, primary key ( a, b )" );
+ TestUtil.createTable( con1, "vv", "a int not null, b int not null, primary key ( a, b )" );
- TestUtil.createTable( con1, "ww", "m int not null, n int not null, primary key ( m, n ), foreign key ( m, n ) references vv ( a, b )" );
+ TestUtil.createTable( con1, "ww", "m int not null, n int not null, primary key ( m, n ), foreign key ( m, n ) references vv ( a, b )" );
DatabaseMetaData dbmd = con.getMetaData();
assertNotNull(dbmd);
- ResultSet rs = dbmd.getCrossReference(null, "", "vv", null, "", "ww" );
+ ResultSet rs = dbmd.getCrossReference(null, "", "vv", null, "", "ww" );
- for (int j=1; rs.next(); j++ )
- {
+ for (int j = 1; rs.next(); j++ )
+ {
- String pkTableName = rs.getString( "PKTABLE_NAME" );
- assertTrue ( pkTableName.equals("vv") );
+ String pkTableName = rs.getString( "PKTABLE_NAME" );
+ assertTrue ( pkTableName.equals("vv") );
- String pkColumnName = rs.getString( "PKCOLUMN_NAME" );
- assertTrue( pkColumnName.equals("a") || pkColumnName.equals("b"));
+ String pkColumnName = rs.getString( "PKCOLUMN_NAME" );
+ assertTrue( pkColumnName.equals("a") || pkColumnName.equals("b"));
- String fkTableName = rs.getString( "FKTABLE_NAME" );
- assertTrue( fkTableName.equals( "ww" ) );
+ String fkTableName = rs.getString( "FKTABLE_NAME" );
+ assertTrue( fkTableName.equals( "ww" ) );
- String fkColumnName = rs.getString( "FKCOLUMN_NAME" );
- assertTrue( fkColumnName.equals( "m" ) || fkColumnName.equals( "n" ) ) ;
+ String fkColumnName = rs.getString( "FKCOLUMN_NAME" );
+ assertTrue( fkColumnName.equals( "m" ) || fkColumnName.equals( "n" ) ) ;
- String fkName = rs.getString( "FK_NAME" );
- assertTrue( fkName.equals( "