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 2005/11/29 05:37:36 UTC

svn commit: r349632 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/GenericStatement.java testing/org/apache/derbyTesting/functionTests/master/miscerrors.out testing/org/apache/derbyTesting/functionTests/tests/lang/miscerrors.sql

Author: djd
Date: Mon Nov 28 20:36:25 2005
New Revision: 349632

URL: http://svn.apache.org/viewcvs?rev=349632&view=rev
Log:
DERBY-730 Remove statement from cache on any exception during compliation, not just bind errors.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/miscerrors.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/miscerrors.sql

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java?rev=349632&r1=349631&r2=349632&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java Mon Nov 28 20:36:25 2005
@@ -412,9 +412,6 @@
 				catch (StandardException se)
 				{
 					lcc.commitNestedTransaction();
-					if (foundInCache)
-						((GenericLanguageConnectionContext)lcc).removeStatement(this);
-
 
 					// Statement logging if lcc.getLogStatementText() is true
 					if (istream != null)
@@ -513,8 +510,6 @@
 				catch (StandardException e) 	// hold it, throw it
 				{
 					lcc.commitNestedTransaction();
-					if (foundInCache)
-						((GenericLanguageConnectionContext)lcc).removeStatement(this);
 					throw e;
 				}
 
@@ -535,6 +530,12 @@
 			{
 				lcc.popCompilerContext( cc );
 			}
+		}
+		catch (StandardException se)
+		{
+			if (foundInCache)
+				((GenericLanguageConnectionContext)lcc).removeStatement(this);
+			throw se;
 		}
 		finally
 		{

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/miscerrors.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/miscerrors.out?rev=349632&r1=349631&r2=349632&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/miscerrors.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/miscerrors.out Mon Nov 28 20:36:25 2005
@@ -28,4 +28,24 @@
 ij> -- set isolation to repeatable read
 set isolation serializable;
 0 rows inserted/updated/deleted
+ij> -- see that statements that fail at parse or bind time
+-- are not put in the statment cache;
+values 1;
+1          
+-----------
+1          
+ij> select SQL_TEXT from syscs_diag.statement_cache where SQL_TEXT LIKE '%932432%';
+SQL_TEXT                                                                                                                        
+--------------------------------------------------------------------------------------------------------------------------------
+select SQL_TEXT from syscs_diag.statement_cache where SQL_TEXT LIKE '%932432%'                                                  
+ij> VALUES FRED932432;
+ERROR 42X04: Column 'FRED932432' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE  statement then 'FRED932432' is not a column in the target table.
+ij> SELECT * FROM BILL932432;
+ERROR 42X05: Table 'BILL932432' does not exist.
+ij> SELECT 932432;
+ERROR 42X01: Syntax error: Encountered "<EOF>" at line 1, column 13.
+ij> select SQL_TEXT from syscs_diag.statement_cache where SQL_TEXT LIKE '%932432%';
+SQL_TEXT                                                                                                                        
+--------------------------------------------------------------------------------------------------------------------------------
+select SQL_TEXT from syscs_diag.statement_cache where SQL_TEXT LIKE '%932432%'                                                  
 ij> 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/miscerrors.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/miscerrors.sql?rev=349632&r1=349631&r2=349632&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/miscerrors.sql (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/miscerrors.sql Mon Nov 28 20:36:25 2005
@@ -29,3 +29,13 @@
 -- set isolation to repeatable read
 set isolation serializable;
 
+-- see that statements that fail at parse or bind time
+-- are not put in the statment cache;
+values 1;
+select SQL_TEXT from syscs_diag.statement_cache where SQL_TEXT LIKE '%932432%';
+
+VALUES FRED932432;
+SELECT * FROM BILL932432;
+SELECT 932432;
+
+select SQL_TEXT from syscs_diag.statement_cache where SQL_TEXT LIKE '%932432%';