diff options
author | Bruce Momjian <bruce@momjian.us> | 2000-10-09 16:48:19 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2000-10-09 16:48:19 +0000 |
commit | a4e3943b3fe6b4fdbca58d5fb41bbafd22a92c15 (patch) | |
tree | 8cbafa34e4105e182bc203530d29c965af327ce0 /src/interfaces/jdbc/org/postgresql/jdbc1 | |
parent | c4ccc6146bfe2d20140da2e388e0d62b41c96f9b (diff) | |
download | postgresql-a4e3943b3fe6b4fdbca58d5fb41bbafd22a92c15.tar.gz |
Back out Gunnar R|nning jdbc changes.
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/jdbc1')
3 files changed, 23 insertions, 25 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc1/Connection.java index 607c19145b..e8ed4970b5 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc1/Connection.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc1/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:54 momjian Exp $ + * $Id: Connection.java,v 1.4 2000/10/09 16:48:17 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/jdbc1/DatabaseMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java index ded0a17b16..674c0d16e1 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java @@ -1497,7 +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()) { @@ -1670,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[]; @@ -1679,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); @@ -1893,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[]; @@ -1901,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); @@ -1915,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(); @@ -2009,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(); @@ -2406,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/jdbc1/Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java index dfba5c14de..43e5d38143 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java @@ -6,7 +6,6 @@ package org.postgresql.jdbc1; // org.postgresql.jdbc2 package. import java.sql.*; -import org.postgresql.PGStatement; import org.postgresql.util.PSQLException; @@ -23,8 +22,9 @@ import org.postgresql.util.PSQLException; * @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) @@ -38,7 +38,7 @@ public class Statement extends PGStatement implements java.sql.Statement */ public Statement (Connection c) { - super(c); + connection = c; } /** @@ -89,8 +89,7 @@ public class Statement extends PGStatement implements java.sql.Statement */ public void close() throws SQLException { - super.close(); - result = null; + result = null; } /** @@ -267,8 +266,7 @@ public class Statement extends PGStatement implements java.sql.Statement */ public boolean execute(String sql) throws SQLException { - deallocate(); - result = connection.ExecSQL(this, sql); + result = connection.ExecSQL(sql); return (result != null && ((org.postgresql.ResultSet)result).reallyResultSet()); } |