diff options
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/jdbc1')
3 files changed, 25 insertions, 23 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc1/Connection.java index f26057b52b..607c19145b 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.2 2000/06/06 11:06:04 peter Exp $ + * $Id: Connection.java,v 1.3 2000/10/08 19:37:54 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("end"); + ExecSQL(null, "end"); else - ExecSQL("begin"); + ExecSQL(null, "begin"); this.autoCommit = autoCommit; } @@ -170,9 +170,9 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co { if (autoCommit) return; - ExecSQL("commit"); + ExecSQL(null, "commit"); autoCommit = true; - ExecSQL("begin"); + ExecSQL(null, "begin"); autoCommit = false; } @@ -188,9 +188,9 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co { if (autoCommit) return; - ExecSQL("rollback"); + ExecSQL(null, "rollback"); autoCommit = true; - ExecSQL("begin"); + ExecSQL(null, "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(q + " READ COMMITTED"); + ExecSQL(null, q + " READ COMMITTED"); return; case java.sql.Connection.TRANSACTION_SERIALIZABLE: - ExecSQL(q + " SERIALIZABLE"); + ExecSQL(null, 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("show xactisolevel"); + ExecSQL(null, "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 674c0d16e1..ded0a17b16 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("select proname, proretset from pg_proc where proname like '"+procedureNamePattern.toLowerCase()+"' order by proname"); + r = connection.ExecSQL(null, "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(sql.toString()); + r = connection.ExecSQL(null, 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("select description from pg_description where objoid="+r.getInt(2)); + java.sql.ResultSet dr = connection.ExecSQL(null, "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("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(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"); 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("select description from pg_description where objoid="+r.getInt(1)); + java.sql.ResultSet dr = connection.ExecSQL(null, "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("select typname from pg_type where oid = "+r.getString(4)); + dr = connection.ExecSQL(null, "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("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(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"); 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("select typname from pg_type"); + java.sql.ResultSet rs = connection.ExecSQL(null, "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 43e5d38143..dfba5c14de 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java @@ -6,6 +6,7 @@ package org.postgresql.jdbc1; // org.postgresql.jdbc2 package. import java.sql.*; +import org.postgresql.PGStatement; import org.postgresql.util.PSQLException; @@ -22,9 +23,8 @@ import org.postgresql.util.PSQLException; * @see java.sql.Statement * @see ResultSet */ -public class Statement implements java.sql.Statement +public class Statement extends PGStatement 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 implements java.sql.Statement */ public Statement (Connection c) { - connection = c; + super(c); } /** @@ -89,7 +89,8 @@ public class Statement implements java.sql.Statement */ public void close() throws SQLException { - result = null; + super.close(); + result = null; } /** @@ -266,7 +267,8 @@ public class Statement implements java.sql.Statement */ public boolean execute(String sql) throws SQLException { - result = connection.ExecSQL(sql); + deallocate(); + result = connection.ExecSQL(this, sql); return (result != null && ((org.postgresql.ResultSet)result).reallyResultSet()); } |
