You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2007/03/26 09:46:11 UTC
svn commit: r522445 - in
/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc:
EmbedResultSet.java EmbedStatement.java
Author: kahatlen
Date: Mon Mar 26 00:46:10 2007
New Revision: 522445
URL: http://svn.apache.org/viewvc?view=rev&rev=522445
Log:
DERBY-1876: Move conversion of query timeout to milliseconds out of
EmbedResultSet's constructor, and get column count without creating a
meta-data object
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java?view=diff&rev=522445&r1=522444&r2=522445
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java Mon Mar 26 00:46:10 2007
@@ -183,7 +183,7 @@
*/
private Statement applicationStmt;
- private long timeoutMillis;
+ private final long timeoutMillis;
private final boolean isAtomic;
@@ -232,7 +232,7 @@
this.timeoutMillis = stmt == null
? 0L
- : (long)stmt.getQueryTimeout() * 1000L;
+ : stmt.timeoutMillis;
this.isAtomic = isAtomic;
@@ -259,7 +259,7 @@
resultDescription = theResults.getResultDescription();
final ExecutionFactory factory = conn.getLanguageConnection().
getLanguageConnectionFactory().getExecutionFactory();
- final int columnCount = getMetaData().getColumnCount();
+ final int columnCount = resultDescription.getColumnCount();
this.currentRow = factory.getValueRow(columnCount);
currentRow.setRowArray(null);
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java?view=diff&rev=522445&r1=522444&r2=522445
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java Mon Mar 26 00:46:10 2007
@@ -94,7 +94,11 @@
private int fetchSize = 1;
private int fetchDirection = JDBC20Translation.FETCH_FORWARD;
int MaxFieldSize;
- private int timeoutSeconds;
+ /**
+ * Query timeout in milliseconds. By default, no statements time
+ * out. Timeout is set explicitly with setQueryTimeout().
+ */
+ long timeoutMillis;
//the state of this statement, set to false when close() is called
private boolean active = true;
@@ -128,10 +132,6 @@
lcc = getEmbedConnection().getLanguageConnection();
applicationConnection = getEmbedConnection().getApplicationConnection();
applicationStatement = this;
-
- // By default, no statements time out.
- // Timeout is set explicitly with setQueryTimeout().
- timeoutSeconds = 0;
}
//
@@ -406,7 +406,7 @@
*/
public final int getQueryTimeout() throws SQLException {
checkStatus();
- return timeoutSeconds;
+ return (int) (timeoutMillis / 1000);
}
/**
@@ -423,7 +423,7 @@
throw newSQLException(SQLState.INVALID_QUERYTIMEOUT_VALUE,
new Integer(seconds));
}
- timeoutSeconds = seconds;
+ timeoutMillis = (long) seconds * 1000;
}
/**
@@ -1177,7 +1177,6 @@
//and clear existing result sets in case this has been cached
a.reset();
a.setMaxRows(maxRows);
- long timeoutMillis = (long)timeoutSeconds * 1000L;
ResultSet resultsToWrap = ps.execute(a,
false,
timeoutMillis);