diff options
author | Barry Lind <barry@xythos.com> | 2002-08-23 20:45:49 +0000 |
---|---|---|
committer | Barry Lind <barry@xythos.com> | 2002-08-23 20:45:49 +0000 |
commit | fe2dec75a9b428f2e4271af32c4f6a31717889f4 (patch) | |
tree | 95e00adfdd223c29e5b8355928bd052905c3e9cf /src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java | |
parent | a2a3192802e12e056806d5921c3fc4a7a6df8b09 (diff) | |
download | postgresql-fe2dec75a9b428f2e4271af32c4f6a31717889f4.tar.gz |
Enhancements to how queries with bind values are stored internally and sent to
the server. Previously we allocated a new String object for the entire final
query we were sending to the database. If you had a big query, or especially
if you had large bind values you ended up with essentially two copies in memory.
This change will reuse the existing objects and therefore should take 1/2 the
memory it does today for a given query. This restructuring will also allow
in the future the ability to stream bytea data to the server instead of the current approach of pulling it all into memory.
I also fixed a test that was failing on a 7.2 database.
Also renamed some internal variables and some minor cleanup.
Modified Files:
jdbc/org/postgresql/core/QueryExecutor.java
jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java')
-rw-r--r-- | src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java index 3b493de2f4..43e71062ab 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java @@ -15,15 +15,13 @@ import org.postgresql.util.PGbytea; import org.postgresql.util.PSQLException; -/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.4 2002/08/14 20:35:39 barry Exp $ +/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.5 2002/08/23 20:45:49 barry Exp $ * This class defines methods of the jdbc2 specification. This class extends * org.postgresql.jdbc1.AbstractJdbc1ResultSet which provides the jdbc1 * methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2ResultSet */ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.AbstractJdbc1ResultSet { - protected String sqlQuery = null; - //needed for updateable result set support protected boolean updateable = false; protected boolean doingUpdates = false; @@ -1254,7 +1252,9 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra public void parseQuery() { - StringTokenizer st = new StringTokenizer(sqlQuery, " \r\t"); + 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 = ""; @@ -1326,11 +1326,6 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra } - public void setSQLQuery(String sqlQuery) { - this.sqlQuery = sqlQuery; - } - - private class PrimaryKey { int index; // where in the result set is this primaryKey String name; // what is the columnName of this primary Key |