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 dj...@apache.org on 2007/09/04 19:48:21 UTC
svn commit: r572753 - in
/db/derby/code/trunk/java/engine/org/apache/derby/impl:
jdbc/EmbedResultSet.java sql/execute/BasicNoPutResultSetImpl.java
sql/execute/NoPutResultSetImpl.java sql/execute/UnionResultSet.java
Author: djd
Date: Tue Sep 4 10:48:20 2007
New Revision: 572753
URL: http://svn.apache.org/viewvc?rev=572753&view=rev
Log:
DERBY-3049 (partial) Change EmbedResultSet to get a ResultDescription from the activation. Cleanup some ResultSet implementations of getResultDescription()
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UnionResultSet.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?rev=572753&r1=572752&r2=572753&view=diff
==============================================================================
--- 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 Tue Sep 4 10:48:20 2007
@@ -251,7 +251,7 @@
}
// Fill in the column types
- resultDescription = theResults.getResultDescription();
+ resultDescription = theResults.getActivation().getResultDescription();
// Only incur the cost of allocating and maintaining
// updated column information if the columns can be updated.
@@ -2219,20 +2219,19 @@
checksBeforeUpdateOrDelete(methodName, columnIndex);
//1)Make sure for updateXXX methods, the column position is not out of range
- ResultDescription rd = theResults.getResultDescription();
- if (columnIndex < 1 || columnIndex > rd.getColumnCount())
+ if (columnIndex < 1 || columnIndex > resultDescription.getColumnCount())
throw Util.generateCsSQLException(SQLState.LANG_INVALID_COLUMN_POSITION,
- new Integer(columnIndex), String.valueOf(rd.getColumnCount()));
+ new Integer(columnIndex), String.valueOf(resultDescription.getColumnCount()));
//2)Make sure the column corresponds to a column in the base table and it is not a derived column
- if (rd.getColumnDescriptor(columnIndex).getSourceTableName() == null)
+ if (resultDescription.getColumnDescriptor(columnIndex).getSourceTableName() == null)
throw Util.generateCsSQLException(SQLState.COLUMN_NOT_FROM_BASE_TABLE,
methodName);
//3)If column not updatable then throw an exception
if (!getMetaData().isWritable(columnIndex))
throw Util.generateCsSQLException(SQLState.LANG_COLUMN_NOT_UPDATABLE_IN_CURSOR,
- theResults.getResultDescription().getColumnDescriptor(columnIndex).getName(),
+ resultDescription.getColumnDescriptor(columnIndex).getName(),
getCursorName());
}
@@ -3592,12 +3591,11 @@
activation.getPreparedStatement().getTargetTable();
// got the underlying (schema.)table name
insertSQL.append(getFullBaseTableName(targetTable));
- ResultDescription rd = theResults.getResultDescription();
insertSQL.append(" (");
// in this for loop we are constructing list of column-names
// and values (?) ,... part of the insert sql
- for (int i=1; i<=rd.getColumnCount(); i++) {
+ for (int i=1; i<=resultDescription.getColumnCount(); i++) {
if (foundOneColumnAlready) {
insertSQL.append(",");
valuesSQL.append(",");
@@ -3605,7 +3603,7 @@
// using quotes around the column name
// to preserve case sensitivity
insertSQL.append(quoteSqlIdentifier(
- rd.getColumnDescriptor(i).getName()));
+ resultDescription.getColumnDescriptor(i).getName()));
if (columnGotUpdated[i-1]) {
valuesSQL.append("?");
} else {
@@ -3631,7 +3629,7 @@
// in this for loop we are assigning values for parameters
//in sql constructed earlier VALUES (?, ..)
- for (int i=1, paramPosition=0; i<=rd.getColumnCount(); i++) {
+ for (int i=1, paramPosition=0; i<=resultDescription.getColumnCount(); i++) {
// if the column got updated, do following
if (columnGotUpdated[i-1]) {
act.getParameterValueSet().
@@ -3690,15 +3688,14 @@
ExecCursorTableReference targetTable = activation.getPreparedStatement().getTargetTable();
updateWhereCurrentOfSQL.append(getFullBaseTableName(targetTable));//got the underlying (schema.)table name
updateWhereCurrentOfSQL.append(" SET ");
- ResultDescription rd = theResults.getResultDescription();
-
- for (int i=1; i<=rd.getColumnCount(); i++) { //in this for loop we are constructing columnname=?,... part of the update sql
+
+ for (int i=1; i<=resultDescription.getColumnCount(); i++) { //in this for loop we are constructing columnname=?,... part of the update sql
if (columnGotUpdated[i-1]) { //if the column got updated, do following
if (foundOneColumnAlready)
updateWhereCurrentOfSQL.append(",");
//using quotes around the column name to preserve case sensitivity
updateWhereCurrentOfSQL.append(quoteSqlIdentifier(
- rd.getColumnDescriptor(i).getName()) + "=?");
+ resultDescription.getColumnDescriptor(i).getName()) + "=?");
foundOneColumnAlready = true;
}
}
@@ -3712,7 +3709,7 @@
Activation act = ps.getActivation(lcc, false);
//in this for loop we are assigning values for parameters in sql constructed earlier with columnname=?,...
- for (int i=1, paramPosition=0; i<=rd.getColumnCount(); i++) {
+ for (int i=1, paramPosition=0; i<=resultDescription.getColumnCount(); i++) {
if (columnGotUpdated[i-1]) //if the column got updated, do following
act.getParameterValueSet().getParameterForSet(paramPosition++).setValue(updateRow.getColumn(i));
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java?rev=572753&r1=572752&r2=572753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java Tue Sep 4 10:48:20 2007
@@ -90,8 +90,6 @@
protected final Activation activation;
private final boolean statisticsTimingOn;
- ResultDescription resultDescription;
-
private transient TransactionController tc;
private int[] baseColumnMap;
@@ -101,7 +99,6 @@
<BR>
Sets beginTime for all children to use to measue constructor time.
*
- * @param resultDescription the result description. May be null.
* @param activation The activation
* @param optimizerEstimatedRowCount The optimizer's estimate of the
* total number of rows for this
@@ -109,15 +106,13 @@
* @param optimizerEstimatedCost The optimizer's estimated cost for
* this result set
*/
- BasicNoPutResultSetImpl(ResultDescription resultDescription,
- Activation activation,
+ BasicNoPutResultSetImpl(Activation activation,
double optimizerEstimatedRowCount,
double optimizerEstimatedCost)
{
this.activation = activation;
if (statisticsTimingOn = getLanguageConnectionContext().getStatisticsTiming())
beginTime = startExecutionTime = getCurrentTimeMillis();
- this.resultDescription = resultDescription;
this.optimizerEstimatedRowCount = optimizerEstimatedRowCount;
this.optimizerEstimatedCost = optimizerEstimatedCost;
}
@@ -650,13 +645,6 @@
/* The following methods are common to almost all sub-classes.
* They are overriden in selected cases.
*/
-
- /**
- * Returns the description of the table's rows
- */
- public ResultDescription getResultDescription() {
- return resultDescription;
- }
/**
* Get the execution time in milliseconds.
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java?rev=572753&r1=572752&r2=572753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java Tue Sep 4 10:48:20 2007
@@ -93,8 +93,7 @@
double optimizerEstimatedRowCount,
double optimizerEstimatedCost)
{
- super(null,
- activation,
+ super(activation,
optimizerEstimatedRowCount,
optimizerEstimatedCost);
@@ -110,7 +109,7 @@
/**
* Returns the description of the table's rows
*/
- public ResultDescription getResultDescription() {
+ public final ResultDescription getResultDescription() {
return activation.getResultDescription();
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UnionResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UnionResultSet.java?rev=572753&r1=572752&r2=572753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UnionResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UnionResultSet.java Tue Sep 4 10:48:20 2007
@@ -90,15 +90,6 @@
//
/**
- * Returns the description of the first source.
- * Assumes the compiler ensured both sources
- * had the same description.
- */
- public ResultDescription getResultDescription() {
- return source1.getResultDescription();
- }
-
- /**
* open the first source.
* @exception StandardException thrown on failure
*/