summaryrefslogtreecommitdiff
path: root/src/interfaces/jdbc/org/postgresql/jdbc2
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/jdbc2')
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java20
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java17
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java13
3 files changed, 26 insertions, 24 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java
index 43e7ee992d..c00b418865 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.2 2000/06/06 11:06:09 peter Exp $
+ * $Id: Connection.java,v 1.3 2000/10/08 19:37:55 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/jdbc2/DatabaseMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java
index 4b8451d1fc..3ff6c87b81 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java
@@ -1497,7 +1497,8 @@ 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 +1671,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 +1680,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 +1894,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 +1902,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 +1916,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 +2010,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 +2407,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/jdbc2/Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java
index 1da970fa88..8b6ca9a298 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java
@@ -8,6 +8,7 @@ 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
@@ -22,9 +23,8 @@ import org.postgresql.util.*;
* @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)
@@ -39,7 +39,7 @@ public class Statement implements java.sql.Statement
*/
public Statement (Connection c)
{
- connection = c;
+ super(c);
}
/**
@@ -90,7 +90,8 @@ public class Statement implements java.sql.Statement
*/
public void close() throws SQLException
{
- result = null;
+ super.close();
+ result = null;
}
/**
@@ -269,8 +270,8 @@ public class Statement implements java.sql.Statement
{
if(escapeProcessing)
sql=connection.EscapeSQL(sql);
-
- result = connection.ExecSQL(sql);
+ deallocate();
+ result = connection.ExecSQL(this, sql);
return (result != null && ((org.postgresql.ResultSet)result).reallyResultSet());
}