Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 32820 invoked from network); 15 Apr 2007 13:31:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Apr 2007 13:31:41 -0000 Received: (qmail 54689 invoked by uid 500); 15 Apr 2007 13:31:47 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 54655 invoked by uid 500); 15 Apr 2007 13:31:47 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 54644 invoked by uid 99); 15 Apr 2007 13:31:47 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 15 Apr 2007 06:31:47 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 15 Apr 2007 06:31:40 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id EB9A41A9838; Sun, 15 Apr 2007 06:31:19 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r528973 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MultiProbeTableScanResultSet.java Date: Sun, 15 Apr 2007 13:31:19 -0000 To: derby-commits@db.apache.org From: kahatlen@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070415133119.EB9A41A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kahatlen Date: Sun Apr 15 06:31:19 2007 New Revision: 528973 URL: http://svn.apache.org/viewvc?view=rev&rev=528973 Log: DERBY-827 (partial) Make MultiProbeTableScanResultSet reusable across executions. Patch contributed by A B . Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MultiProbeTableScanResultSet.java Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MultiProbeTableScanResultSet.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MultiProbeTableScanResultSet.java?view=diff&rev=528973&r1=528972&r2=528973 ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MultiProbeTableScanResultSet.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MultiProbeTableScanResultSet.java Sun Apr 15 06:31:19 2007 @@ -67,16 +67,21 @@ { /* The values with which we will probe the table. */ protected DataValueDescriptor [] probeValues; + /** + * The values with which we will probe the table, as they were passed to + * the constructor. We need to keep them unchanged in case the result set + * is reused when a statement is re-executed (see DERBY-827). + */ + protected DataValueDescriptor [] origProbeValues; /* 0-based position of the *next* value to lookup w.r.t. the probe * values list. */ protected int probeValIndex; - /* Whether or not we need to sort the values (sorting should only - * happen once). If all values were specified as literals (as - * opposed to parameters) then we did the sort at compile time - * and so we do not need to do it here. + /* Whether or not we need to sort the values. If all values were + * specified as literals (as opposed to parameters) then we did the + * sort at compile time and so we do not need to do it here. */ private boolean needSort; @@ -154,7 +159,7 @@ " is not the case."); } - this.probeValues = probingVals; + this.origProbeValues = probingVals; this.needSort = !probeValsAreSorted; } @@ -183,17 +188,16 @@ * ideal, but it works for now. */ DataValueDescriptor [] pVals = - new DataValueDescriptor[probeValues.length]; + new DataValueDescriptor[origProbeValues.length]; for (int i = 0; i < pVals.length; i++) - pVals[i] = probeValues[i].getClone(); + pVals[i] = origProbeValues[i].getClone(); java.util.Arrays.sort(pVals); probeValues = pVals; - - // Only sort once. - needSort = false; } + else + probeValues = origProbeValues; probeValIndex = 0; super.openCore();