Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 12414 invoked from network); 7 Feb 2008 08:46:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Feb 2008 08:46:32 -0000 Received: (qmail 94474 invoked by uid 500); 7 Feb 2008 08:46:25 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 94441 invoked by uid 500); 7 Feb 2008 08:46:25 -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 94430 invoked by uid 99); 7 Feb 2008 08:46:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Feb 2008 00:46:25 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED 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; Thu, 07 Feb 2008 08:46:17 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D59F51A9832; Thu, 7 Feb 2008 00:46:08 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r619306 - /db/derby/code/trunk/java/client/org/apache/derby/client/am/stmtcache/StatementKey.java Date: Thu, 07 Feb 2008 08:46:08 -0000 To: derby-commits@db.apache.org From: kristwaa@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080207084608.D59F51A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kristwaa Date: Thu Feb 7 00:46:06 2008 New Revision: 619306 URL: http://svn.apache.org/viewvc?rev=619306&view=rev Log: DERBY-3324: JDBC statement cache implementation. Added asserts (for sane builds) to check validity of StatementKey arguments (for instance result set holdability and concurrency). The asserts are added because there are so many integer arguments, and they can easily be mixed up. Patch file: derby-3324-4a-statementkey_asserts.diff Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/stmtcache/StatementKey.java Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/stmtcache/StatementKey.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/stmtcache/StatementKey.java?rev=619306&r1=619305&r2=619306&view=diff ============================================================================== --- db/derby/code/trunk/java/client/org/apache/derby/client/am/stmtcache/StatementKey.java (original) +++ db/derby/code/trunk/java/client/org/apache/derby/client/am/stmtcache/StatementKey.java Thu Feb 7 00:46:06 2008 @@ -21,6 +21,10 @@ package org.apache.derby.client.am.stmtcache; +import java.sql.ResultSet; +import java.sql.Statement; +import org.apache.derby.shared.common.sanity.SanityManager; + /** * A key representing a java.sql.PreparedStatement or a * java.sql.CallableStatement. @@ -82,6 +86,26 @@ this.concurrency = rsConcurrency; this.holdability = rsHoldability; this.autogeneratedKeys = autogeneratedKeys; + // In sane builds, make sure valid JDBC values are passed. + if (SanityManager.DEBUG) { + SanityManager.ASSERT( + rsType == ResultSet.TYPE_FORWARD_ONLY || + rsType == ResultSet.TYPE_SCROLL_INSENSITIVE || + rsType == ResultSet.TYPE_SCROLL_SENSITIVE, + "Invalid result set type: " + rsType); + SanityManager.ASSERT( + rsConcurrency == ResultSet.CONCUR_READ_ONLY || + rsConcurrency == ResultSet.CONCUR_UPDATABLE, + "Invalid result set concurrency: " + rsConcurrency); + SanityManager.ASSERT( + rsHoldability == ResultSet.HOLD_CURSORS_OVER_COMMIT || + rsHoldability == ResultSet.CLOSE_CURSORS_AT_COMMIT, + "Invalid result set holdability: " + rsHoldability); + SanityManager.ASSERT( + autogeneratedKeys == Statement.NO_GENERATED_KEYS || + autogeneratedKeys == Statement.RETURN_GENERATED_KEYS, + "Invalid autogenerated key value: " + autogeneratedKeys); + } } public boolean equals(Object obj) {