diff options
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/jdbc2')
3 files changed, 24 insertions, 26 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java index c00b418865..48e304da2a 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java @@ -17,7 +17,7 @@ import org.postgresql.largeobject.*; import org.postgresql.util.*; /** - * $Id: Connection.java,v 1.3 2000/10/08 19:37:55 momjian Exp $ + * $Id: Connection.java,v 1.4 2000/10/09 16:48:18 momjian Exp $ * * A Connection represents a session with a specific database. Within the * context of a Connection, SQL statements are executed and results are @@ -138,9 +138,9 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co if (this.autoCommit == autoCommit) return; if (autoCommit) - ExecSQL(null, "end"); + ExecSQL("end"); else - ExecSQL(null, "begin"); + ExecSQL("begin"); this.autoCommit = autoCommit; } @@ -170,9 +170,9 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co { if (autoCommit) return; - ExecSQL(null, "commit"); + ExecSQL("commit"); autoCommit = true; - ExecSQL(null, "begin"); + ExecSQL("begin"); autoCommit = false; } @@ -188,9 +188,9 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co { if (autoCommit) return; - ExecSQL(null, "rollback"); + ExecSQL("rollback"); autoCommit = true; - ExecSQL(null, "begin"); + ExecSQL("begin"); autoCommit = false; } @@ -316,11 +316,11 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co switch(level) { case java.sql.Connection.TRANSACTION_READ_COMMITTED: - ExecSQL(null, q + " READ COMMITTED"); + ExecSQL(q + " READ COMMITTED"); return; case java.sql.Connection.TRANSACTION_SERIALIZABLE: - ExecSQL(null, q + " SERIALIZABLE"); + ExecSQL(q + " SERIALIZABLE"); return; default: @@ -336,7 +336,7 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co */ public int getTransactionIsolation() throws SQLException { - ExecSQL(null, "show xactisolevel"); + ExecSQL("show xactisolevel"); SQLWarning w = getWarnings(); if (w != null) { diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java index 3ff6c87b81..4b8451d1fc 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java @@ -1497,8 +1497,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData if(procedureNamePattern==null) procedureNamePattern="%"; - r = connection.ExecSQL(null, - "select proname, proretset from pg_proc where proname like '"+procedureNamePattern.toLowerCase()+"' order by proname"); + r = connection.ExecSQL("select proname, proretset from pg_proc where proname like '"+procedureNamePattern.toLowerCase()+"' order by proname"); while (r.next()) { @@ -1671,7 +1670,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData sql.append("'"); // Now run the query - r = connection.ExecSQL(null, sql.toString()); + r = connection.ExecSQL(sql.toString()); byte remarks[]; @@ -1680,7 +1679,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData byte[][] tuple = new byte[5][0]; // Fetch the description for the table (if any) - java.sql.ResultSet dr = connection.ExecSQL(null, "select description from pg_description where objoid="+r.getInt(2)); + java.sql.ResultSet dr = connection.ExecSQL("select description from pg_description where objoid="+r.getInt(2)); if(((org.postgresql.ResultSet)dr).getTupleCount()==1) { dr.next(); remarks = dr.getBytes(1); @@ -1894,7 +1893,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData // Now form the query // Modified by Stefan Andreasen <stefan@linux.kapow.dk> - r = connection.ExecSQL(null, "select a.oid,c.relname,a.attname,a.atttypid,a.attnum,a.attnotnull,a.attlen,a.atttypmod from pg_class c, pg_attribute a where a.attrelid=c.oid and c.relname like '"+tableNamePattern.toLowerCase()+"' and a.attname like '"+columnNamePattern.toLowerCase()+"' and a.attnum>0 order by c.relname,a.attnum"); + r = connection.ExecSQL("select a.oid,c.relname,a.attname,a.atttypid,a.attnum,a.attnotnull,a.attlen,a.atttypmod from pg_class c, pg_attribute a where a.attrelid=c.oid and c.relname like '"+tableNamePattern.toLowerCase()+"' and a.attname like '"+columnNamePattern.toLowerCase()+"' and a.attnum>0 order by c.relname,a.attnum"); byte remarks[]; @@ -1902,7 +1901,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData byte[][] tuple = new byte[18][0]; // Fetch the description for the table (if any) - java.sql.ResultSet dr = connection.ExecSQL(null, "select description from pg_description where objoid="+r.getInt(1)); + java.sql.ResultSet dr = connection.ExecSQL("select description from pg_description where objoid="+r.getInt(1)); if(((org.postgresql.ResultSet)dr).getTupleCount()==1) { dr.next(); tuple[11] = dr.getBytes(1); @@ -1916,7 +1915,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData tuple[2] = r.getBytes(2); // Table name tuple[3] = r.getBytes(3); // Column name - dr = connection.ExecSQL(null, "select typname from pg_type where oid = "+r.getString(4)); + dr = connection.ExecSQL("select typname from pg_type where oid = "+r.getString(4)); dr.next(); String typname=dr.getString(1); dr.close(); @@ -2010,7 +2009,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData f[7] = new Field(connection,"IS_GRANTABLE",iVarcharOid,32); // This is taken direct from the psql source - java.sql.ResultSet r = connection.ExecSQL(null, "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 '"+table.toLowerCase()+"' ORDER BY relname"); + 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 '"+table.toLowerCase()+"' ORDER BY relname"); while(r.next()) { byte[][] tuple = new byte[8][0]; tuple[0] = tuple[1]= "".getBytes(); @@ -2407,7 +2406,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData */ public java.sql.ResultSet getTypeInfo() throws SQLException { - java.sql.ResultSet rs = connection.ExecSQL(null, "select typname from pg_type"); + java.sql.ResultSet rs = connection.ExecSQL("select typname from pg_type"); if(rs!=null) { Field f[] = new Field[18]; ResultSet r; // ResultSet for the SQL query that we need to do diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java index 8b6ca9a298..1da970fa88 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java @@ -8,7 +8,6 @@ package org.postgresql.jdbc2; import java.sql.*; import java.util.Vector; import org.postgresql.util.*; -import org.postgresql.PGStatement; /** * A Statement object is used for executing a static SQL statement and @@ -23,8 +22,9 @@ import org.postgresql.PGStatement; * @see java.sql.Statement * @see ResultSet */ -public class Statement extends PGStatement implements java.sql.Statement +public class Statement implements java.sql.Statement { + Connection connection; // The connection who created us java.sql.ResultSet result = null; // The current results SQLWarning warnings = null; // The warnings chain. int timeout = 0; // The timeout for a query (not used) @@ -39,7 +39,7 @@ public class Statement extends PGStatement implements java.sql.Statement */ public Statement (Connection c) { - super(c); + connection = c; } /** @@ -90,8 +90,7 @@ public class Statement extends PGStatement implements java.sql.Statement */ public void close() throws SQLException { - super.close(); - result = null; + result = null; } /** @@ -270,8 +269,8 @@ public class Statement extends PGStatement implements java.sql.Statement { if(escapeProcessing) sql=connection.EscapeSQL(sql); - deallocate(); - result = connection.ExecSQL(this, sql); + + result = connection.ExecSQL(sql); return (result != null && ((org.postgresql.ResultSet)result).reallyResultSet()); } |
