teiid SVN: r1133 - trunk/build/kit-embedded/deploy.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-15 10:57:06 -0400 (Wed, 15 Jul 2009)
New Revision: 1133
Modified:
trunk/build/kit-embedded/deploy/configuration.xml
Log:
TEIID-259
Modified: trunk/build/kit-embedded/deploy/configuration.xml
===================================================================
--- trunk/build/kit-embedded/deploy/configuration.xml 2009-07-15 14:23:42 UTC (rev 1132)
+++ trunk/build/kit-embedded/deploy/configuration.xml 2009-07-15 14:57:06 UTC (rev 1133)
@@ -2,11 +2,11 @@
<ConfigurationDocument>
<Header>
<ApplicationCreatedBy>Teiid</ApplicationCreatedBy>
- <ApplicationVersionCreatedBy>6.0</ApplicationVersionCreatedBy>
+ <ApplicationVersionCreatedBy>6.2</ApplicationVersionCreatedBy>
<UserCreatedBy>Configuration</UserCreatedBy>
- <ConfigurationVersion>6.0</ConfigurationVersion>
- <MetaMatrixSystemVersion>6.0</MetaMatrixSystemVersion>
- <Time>2009-03-20T12:23:53.919-06:00</Time>
+ <ConfigurationVersion>6.2</ConfigurationVersion>
+ <MetaMatrixSystemVersion>6.2</MetaMatrixSystemVersion>
+ <Time>2009-07-20T12:23:53.919-06:00</Time>
</Header>
<Configuration Name="Next Startup" ComponentType="Configuration" LastChangedBy="ConfigurationStartup" CreatedBy="ConfigurationStartup">
<Properties />
15 years, 5 months
teiid SVN: r1132 - in trunk/build/kit-embedded/examples/portfolio: java and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-15 10:23:42 -0400 (Wed, 15 Jul 2009)
New Revision: 1132
Modified:
trunk/build/kit-embedded/examples/portfolio/java/JDBCClient.java
trunk/build/kit-embedded/examples/portfolio/java/jdbcclient.jar
trunk/build/kit-embedded/examples/portfolio/run.bat
trunk/build/kit-embedded/examples/portfolio/run.sh
Log:
TEIID-259: fixing the JDBC Example with service related changes.
Modified: trunk/build/kit-embedded/examples/portfolio/java/JDBCClient.java
===================================================================
--- trunk/build/kit-embedded/examples/portfolio/java/JDBCClient.java 2009-07-15 14:13:56 UTC (rev 1131)
+++ trunk/build/kit-embedded/examples/portfolio/java/JDBCClient.java 2009-07-15 14:23:42 UTC (rev 1132)
@@ -26,7 +26,8 @@
import java.sql.SQLException;
import java.sql.Statement;
-import com.metamatrix.jdbc.EmbeddedDataSource;
+import org.teiid.jdbc.TeiidDataSource;
+import org.teiid.jdbc.TeiidDriver;
public class JDBCClient {
public static void main(String[] args) throws Exception {
@@ -48,12 +49,15 @@
String url = "jdbc:metamatrix:Portfolio";
Class.forName("org.teiid.jdbc.TeiidDriver");
- return DriverManager.getConnection(url);
+ return DriverManager.getConnection(url,"admin", "teiid");
}
static Connection getDataSourceConnection() throws Exception {
- EmbeddedDataSource ds = new EmbeddedDataSource();
+ TeiidDataSource ds = new TeiidDataSource();
ds.setDatabaseName("Portfolio");
+ ds.setEmbeddedBootstrapFile("classpath:/deploy.properties");
+ ds.setUser("admin");
+ ds.setPassword("teiid");
return ds.getConnection();
}
Modified: trunk/build/kit-embedded/examples/portfolio/java/jdbcclient.jar
===================================================================
(Binary files differ)
Modified: trunk/build/kit-embedded/examples/portfolio/run.bat
===================================================================
--- trunk/build/kit-embedded/examples/portfolio/run.bat 2009-07-15 14:13:56 UTC (rev 1131)
+++ trunk/build/kit-embedded/examples/portfolio/run.bat 2009-07-15 14:23:42 UTC (rev 1132)
@@ -2,7 +2,7 @@
set CLIENT_PATH=java/*;PortfolioModel/
rem Second one for the JARs in Teiid embedded
-set TEIID_PATH=../../teiid-${pom.version}-client.jar;../../deploy;../../lib/patches/*;../../lib/*;../../extensions/*
+set TEIID_PATH=../../client/teiid-${pom.version}-client.jar;../../deploy;../../lib/patches/*;../../lib/*;../../extensions/*
java -cp %CLIENT_PATH%;%TEIID_PATH% JDBCClient "select * from CustomerAccount"
Modified: trunk/build/kit-embedded/examples/portfolio/run.sh
===================================================================
--- trunk/build/kit-embedded/examples/portfolio/run.sh 2009-07-15 14:13:56 UTC (rev 1131)
+++ trunk/build/kit-embedded/examples/portfolio/run.sh 2009-07-15 14:23:42 UTC (rev 1132)
@@ -4,6 +4,6 @@
CLIENT_PATH=java/*:PortfolioModel/
#Second one for the JARs in Teiid embedded
-TEIID_PATH=../../teiid-${pom.version}-client.jar:../../deploy:../../lib/patches/*:../../lib/*:../../extensions/*
+TEIID_PATH=../../client/teiid-${pom.version}-client.jar:../../deploy:../../lib/patches/*:../../lib/*:../../extensions/*
java -cp ${CLIENT_PATH}:${TEIID_PATH} JDBCClient "select * from CustomerAccount"
15 years, 5 months
teiid SVN: r1131 - in trunk: engine/src/main/resources/com/metamatrix/dqp and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-15 10:13:56 -0400 (Wed, 15 Jul 2009)
New Revision: 1131
Modified:
trunk/client/src/main/resources/com/metamatrix/admin/i18n.properties
trunk/engine/src/main/resources/com/metamatrix/dqp/i18n.properties
Log:
missing i18 key
Modified: trunk/client/src/main/resources/com/metamatrix/admin/i18n.properties
===================================================================
--- trunk/client/src/main/resources/com/metamatrix/admin/i18n.properties 2009-07-15 13:34:35 UTC (rev 1130)
+++ trunk/client/src/main/resources/com/metamatrix/admin/i18n.properties 2009-07-15 14:13:56 UTC (rev 1131)
@@ -347,4 +347,4 @@
Unable_to_read_data_from_stream=Unable to read data from the stream: {0}
no_response_server=No response received from server.
Request.query_plan_not_allowed=Query Plan not allowed in this context. Please remove the SHOWPLAN or PLANONLY option.
-Request.wsdl_user_not_authorized=The WSDL user is not authorized for this action.
+Request.wsdl_user_not_authorized=The anonymous user is not authorized for this action.
Modified: trunk/engine/src/main/resources/com/metamatrix/dqp/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/com/metamatrix/dqp/i18n.properties 2009-07-15 13:34:35 UTC (rev 1130)
+++ trunk/engine/src/main/resources/com/metamatrix/dqp/i18n.properties 2009-07-15 14:13:56 UTC (rev 1131)
@@ -381,7 +381,9 @@
Request.transaction_not_supported=Autowrap transaction required, but transaction support is disabled
Request.potentially_unsafe=The request is modifying more than 1 model without any containing transaction (txnAutoWrap = OFF). This is potentially unsafe as the updates cannot be rolled back as a single unit.
Request.no_result_set=Statement does not return a result set.
-Request.result_set=Statement returns a result set, not an update count.
+Request.result_set=Statement returns a result set, not an update count.
+Request.wsdl_user_not_authorized=The anonymous user is not authorized for this action.
+
ParameterImpl.Invalid_direction=Invalid parameter direction: {0}
DQPCORE.6=Unable to create ResulSet cache.
ResultSetCache.1=Result batches are not contiguous in cache.
15 years, 5 months
teiid SVN: r1130 - in trunk: server/src/test/java/com/metamatrix/platform/security/api and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-15 09:34:35 -0400 (Wed, 15 Jul 2009)
New Revision: 1130
Modified:
trunk/embedded/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationRealm.java
trunk/server/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationRealm.java
Log:
TEIID-719: making the authorization realm check case in-sensitive
Modified: trunk/embedded/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationRealm.java
===================================================================
--- trunk/embedded/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationRealm.java 2009-07-14 20:26:44 UTC (rev 1129)
+++ trunk/embedded/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationRealm.java 2009-07-15 13:34:35 UTC (rev 1130)
@@ -83,7 +83,7 @@
fail(realm_2 + " != " + realm_5 + " but should be."); //$NON-NLS-1$ //$NON-NLS-2$
}
- assertFalse(realm_5.equals(realm_6));
+ assertTrue(realm_5.equals(realm_6));
}
}
Modified: trunk/server/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationRealm.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationRealm.java 2009-07-14 20:26:44 UTC (rev 1129)
+++ trunk/server/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationRealm.java 2009-07-15 13:34:35 UTC (rev 1130)
@@ -83,7 +83,7 @@
fail(realm_2 + " != " + realm_5 + " but should be."); //$NON-NLS-1$ //$NON-NLS-2$
}
- assertFalse(realm_5.equals(realm_6));
+ assertTrue(realm_5.equals(realm_6));
}
}
15 years, 5 months
teiid SVN: r1129 - in trunk/test-integration/src/test: resources and 1 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-14 16:26:44 -0400 (Tue, 14 Jul 2009)
New Revision: 1129
Added:
trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestDataEntitlements.java
trunk/test-integration/src/test/resources/authcheck/
trunk/test-integration/src/test/resources/authcheck/bqt.def
trunk/test-integration/src/test/resources/authcheck/bqt.properties
trunk/test-integration/src/test/resources/authcheck/bqt.vdb
trunk/test-integration/src/test/resources/authcheck/groups.properties
trunk/test-integration/src/test/resources/authcheck/membership-file.properties
trunk/test-integration/src/test/resources/authcheck/users.properties
Log:
TEIID-665: Integration test to check entitlements
Added: trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestDataEntitlements.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestDataEntitlements.java (rev 0)
+++ trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestDataEntitlements.java 2009-07-14 20:26:44 UTC (rev 1129)
@@ -0,0 +1,63 @@
+package com.metamatrix.server.integration;
+
+import junit.framework.TestCase;
+
+import org.junit.Test;
+
+import com.metamatrix.core.util.UnitTestUtil;
+import com.metamatrix.jdbc.api.AbstractMMQueryTestCase;
+
+public class TestDataEntitlements extends AbstractMMQueryTestCase {
+
+ private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath() + "/authcheck/bqt.properties;"; //$NON-NLS-1$
+ private static final String VDB = "bqt"; //$NON-NLS-1$
+
+ @Test public void testNoUserAuth() {
+ try {
+ getConnection(VDB, DQP_PROP_FILE, "user=test"); //$NON-NLS-1$
+ TestCase.fail("Should have failed authenticate user test"); //$NON-NLS-1$
+ } catch (Exception e) {
+ }
+ }
+
+ @Test public void testAdminAuth() {
+ try {
+ getConnection(VDB, DQP_PROP_FILE, "user=admin;password=mm"); //$NON-NLS-1$
+ TestCase.fail("Should have failed authenticate user test"); //$NON-NLS-1$
+ } catch (Exception e) {
+ }
+
+ getConnection(VDB, DQP_PROP_FILE, "user=admin;password=teiid"); //$NON-NLS-1$
+ execute("select * from BQT1.smalla"); //$NON-NLS-1$
+ walkResults();
+ }
+
+ @Test public void testEntitlements() {
+ try {
+ getConnection(VDB, DQP_PROP_FILE, "user=john;password=foo"); //$NON-NLS-1$
+ TestCase.fail("Should have failed authenticate user test"); //$NON-NLS-1$
+ } catch (Exception e) {
+ }
+
+ try {
+ getConnection(VDB, DQP_PROP_FILE, "user=john;password=mm"); //$NON-NLS-1$
+ execute("select intkey, stringkey from BQT1.smalla"); //$NON-NLS-1$
+ walkResults();
+ } catch(Exception e) {
+ TestCase.assertTrue(e.getMessage().endsWith("is not entitled to action <Read> for 1 or more of the groups/elements/procedures.")); //$NON-NLS-1$
+ }
+
+ getConnection(VDB, DQP_PROP_FILE, "user=paul;password=mm"); //$NON-NLS-1$
+ execute("select intkey, stringkey from BQT1.smalla"); //$NON-NLS-1$
+ assertRowCount(50);
+
+ try {
+ getConnection(VDB, DQP_PROP_FILE, "user=paul;password=mm"); //$NON-NLS-1$
+ execute("select * from BQT1.smalla"); //$NON-NLS-1$
+ walkResults();
+ } catch(Exception e) {
+ TestCase.assertTrue(e.getMessage().endsWith("is not entitled to action <Read> for 1 or more of the groups/elements/procedures.")); //$NON-NLS-1$
+ }
+ }
+
+}
Property changes on: trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestDataEntitlements.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/test-integration/src/test/resources/authcheck/bqt.def
===================================================================
--- trunk/test-integration/src/test/resources/authcheck/bqt.def (rev 0)
+++ trunk/test-integration/src/test/resources/authcheck/bqt.def 2009-07-14 20:26:44 UTC (rev 1129)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VDB>
+ <VDBInfo>
+ <Property Name="Name" Value="BQT" />
+ <Property Name="Version" Value="1" />
+ <Property Name="VDBArchiveName" Value="bqt.vdb" />
+ <Property Name="Description" Value="" />
+ <Property Name="IsActive" Value="true" />
+ </VDBInfo>
+ <Model>
+ <Property Name="Name" Value="XQT" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ </Model>
+ <Model>
+ <Property Name="Name" Value="VQT" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ </Model>
+ <Model>
+ <Property Name="Name" Value="XQTDoc" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ </Model>
+ <Model>
+ <Property Name="Name" Value="BQT2" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ <ConnectorBindings>
+ <Connector Name="Derby Connector" />
+ </ConnectorBindings>
+ </Model>
+ <Model>
+ <Property Name="Name" Value="XQTRecursiveDoc" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ </Model>
+ <Model>
+ <Property Name="Name" Value="XQTNestedDoc" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ </Model>
+ <Model>
+ <Property Name="Name" Value="SP" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ <ConnectorBindings>
+ <Connector Name="Derby Connector" />
+ </ConnectorBindings>
+ </Model>
+ <Model>
+ <Property Name="Name" Value="BQT1" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ <ConnectorBindings>
+ <Connector Name="Derby Connector" />
+ </ConnectorBindings>
+ </Model>
+ <ConnectorBindings>
+ <Connector Name="Derby Connector" ComponentType="Apache Derby Embedded Connector">
+ <Properties>
+ <Property Name="Immutable">true</Property>
+ <Property Name="URL">jdbc:derby:jar:(src/test/resources/derby/sample.zip)bqt</Property>
+ </Properties>
+ </Connector>
+ </ConnectorBindings>
+</VDB>
+
Added: trunk/test-integration/src/test/resources/authcheck/bqt.properties
===================================================================
--- trunk/test-integration/src/test/resources/authcheck/bqt.properties (rev 0)
+++ trunk/test-integration/src/test/resources/authcheck/bqt.properties 2009-07-14 20:26:44 UTC (rev 1129)
@@ -0,0 +1,41 @@
+#
+# JBoss, Home of Professional Open Source.
+# See the COPYRIGHT.txt file distributed with this work for information
+# regarding copyright ownership. Some portions may be licensed
+# to Red Hat, Inc. under one or more contributor license agreements.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA.
+#
+
+dqp.configFile=../ServerConfig.xml
+vdb.definition=./bqt.def
+
+#only for testing, as this takes more time to start and shutdown
+metamatrix.xatxnmgr.enable_recovery=false
+
+membership.enabled=true
+membership.superUser=admin
+membership.superUserPassword=teiid
+membership.DomainOrder=file
+
+# File Membership Domain Settings (activate, Membership Domain Class Name, Property file for configuration)
+file.activate=true
+file.AuthDomainClass=com.metamatrix.platform.security.membership.spi.file.FileMembershipDomain
+file.propertiesFile=membership-file.properties
+
+entitlements.enabled=true
+
+
Property changes on: trunk/test-integration/src/test/resources/authcheck/bqt.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/test-integration/src/test/resources/authcheck/bqt.vdb
===================================================================
(Binary files differ)
Property changes on: trunk/test-integration/src/test/resources/authcheck/bqt.vdb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/test-integration/src/test/resources/authcheck/groups.properties
===================================================================
--- trunk/test-integration/src/test/resources/authcheck/groups.properties (rev 0)
+++ trunk/test-integration/src/test/resources/authcheck/groups.properties 2009-07-14 20:26:44 UTC (rev 1129)
@@ -0,0 +1,2 @@
+group1=paul
+
Property changes on: trunk/test-integration/src/test/resources/authcheck/groups.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/test-integration/src/test/resources/authcheck/membership-file.properties
===================================================================
--- trunk/test-integration/src/test/resources/authcheck/membership-file.properties (rev 0)
+++ trunk/test-integration/src/test/resources/authcheck/membership-file.properties 2009-07-14 20:26:44 UTC (rev 1129)
@@ -0,0 +1,11 @@
+#File based membership domain configuration properties
+
+#Location of the properties file containing user name and password entries.
+usersFile=users.properties
+
+#Location of the properties file containing group assignments
+groupsFile=groups.properties
+
+#Check passwords against the users file.
+checkPassword=true
+
Property changes on: trunk/test-integration/src/test/resources/authcheck/membership-file.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/test-integration/src/test/resources/authcheck/users.properties
===================================================================
--- trunk/test-integration/src/test/resources/authcheck/users.properties (rev 0)
+++ trunk/test-integration/src/test/resources/authcheck/users.properties 2009-07-14 20:26:44 UTC (rev 1129)
@@ -0,0 +1,3 @@
+john=mm
+paul=mm
+
Property changes on: trunk/test-integration/src/test/resources/authcheck/users.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 5 months
teiid SVN: r1128 - in trunk/engine/src: main/java/com/metamatrix/query/processor/proc and 6 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-07-14 16:23:53 -0400 (Tue, 14 Jul 2009)
New Revision: 1128
Added:
trunk/engine/src/main/java/com/metamatrix/query/sql/lang/TranslatableProcedureContainer.java
Modified:
trunk/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java
trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Delete.java
trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Update.java
trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/CriteriaTranslatorVisitor.java
trunk/engine/src/test/java/com/metamatrix/query/processor/FakeDataManager.java
trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java
trunk/engine/src/test/java/com/metamatrix/query/unittest/FakeMetadataFactory.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
Log:
TEIID-718 fix for translate criteria introducing variables from the parent scope. added the notion of implicit parameters to set the value for references of this type.
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java 2009-07-14 17:38:11 UTC (rev 1127)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java 2009-07-14 20:23:53 UTC (rev 1128)
@@ -55,6 +55,7 @@
import com.metamatrix.query.sql.lang.Into;
import com.metamatrix.query.sql.lang.ProcedureContainer;
import com.metamatrix.query.sql.lang.Query;
+import com.metamatrix.query.sql.lang.TranslatableProcedureContainer;
import com.metamatrix.query.sql.proc.AssignmentStatement;
import com.metamatrix.query.sql.proc.Block;
import com.metamatrix.query.sql.proc.CommandStatement;
@@ -139,6 +140,9 @@
Map params = container.getProcedureParameters();
plan.setParams(params);
plan.setMetadata(metadata);
+ if (container instanceof TranslatableProcedureContainer) {
+ plan.setImplicitParams(((TranslatableProcedureContainer)container).getImplicitParams());
+ }
}
plan.setUpdateProcedure(((CreateUpdateProcedureCommand)procCommand).isUpdateProcedure());
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java 2009-07-14 17:38:11 UTC (rev 1127)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java 2009-07-14 20:23:53 UTC (rev 1128)
@@ -64,6 +64,7 @@
import com.metamatrix.query.sql.lang.Criteria;
import com.metamatrix.query.sql.symbol.ElementSymbol;
import com.metamatrix.query.sql.symbol.Expression;
+import com.metamatrix.query.sql.symbol.Reference;
import com.metamatrix.query.sql.util.VariableContext;
import com.metamatrix.query.tempdata.TempTableStore;
import com.metamatrix.query.tempdata.TempTableStoreImpl;
@@ -90,6 +91,7 @@
private List batchRows;
private boolean lastBatch = false;
private Map<ElementSymbol, Expression> params;
+ private Map<ElementSymbol, Reference> implicitParams;
private QueryMetadataInterface metadata;
private Map tupleSourceMap = new HashMap(); // rsName -> TupleSource
@@ -197,20 +199,29 @@
}
public void open() throws MetaMatrixProcessingException, MetaMatrixComponentException {
- if (this.params != null && !this.evaluatedParams) {
- for (Map.Entry<ElementSymbol, Expression> entry : this.params.entrySet()) {
- ElementSymbol param = entry.getKey();
- Expression expr = entry.getValue();
-
- VariableContext context = getCurrentVariableContext();
- Object value = this.evaluateExpression(expr);
-
- //check constraint
- if (value == null && !metadata.elementSupports(param.getMetadataID(), SupportConstants.Element.NULL)) {
- throw new QueryValidatorException(QueryExecPlugin.Util.getString("ProcedurePlan.nonNullableParam", expr)); //$NON-NLS-1$
- }
- context.setValue(param, value);
- }
+ if (!this.evaluatedParams) {
+ if (this.params != null) {
+ for (Map.Entry<ElementSymbol, Expression> entry : this.params.entrySet()) {
+ ElementSymbol param = entry.getKey();
+ Expression expr = entry.getValue();
+
+ VariableContext context = getCurrentVariableContext();
+ Object value = this.evaluateExpression(expr);
+
+ //check constraint
+ if (value == null && !metadata.elementSupports(param.getMetadataID(), SupportConstants.Element.NULL)) {
+ throw new QueryValidatorException(QueryExecPlugin.Util.getString("ProcedurePlan.nonNullableParam", expr)); //$NON-NLS-1$
+ }
+ context.setValue(param, value);
+ }
+ }
+ if (this.implicitParams != null) {
+ for (Map.Entry<ElementSymbol, Reference> entry : this.implicitParams.entrySet()) {
+ VariableContext context = getCurrentVariableContext();
+ Object value = this.evaluateExpression(entry.getValue());
+ context.setValue(entry.getKey(), value);
+ }
+ }
}
this.evaluatedParams = true;
}
@@ -362,6 +373,7 @@
plan.setUpdateProcedure(this.isUpdateProcedure());
plan.setOutputElements(this.getOutputElements());
plan.setParams(params);
+ plan.setImplicitParams(implicitParams);
plan.setMetadata(metadata);
return plan;
}
@@ -423,6 +435,10 @@
public void setParams( Map<ElementSymbol, Expression> params ) {
this.params = params;
}
+
+ public void setImplicitParams(Map<ElementSymbol, Reference> implicitParams) {
+ this.implicitParams = implicitParams;
+ }
private void createVariableContext() {
this.currentVarContext = new VariableContext(true);
Modified: trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java 2009-07-14 17:38:11 UTC (rev 1127)
+++ trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java 2009-07-14 20:23:53 UTC (rev 1128)
@@ -108,6 +108,7 @@
import com.metamatrix.query.sql.lang.SubqueryContainer;
import com.metamatrix.query.sql.lang.SubqueryFromClause;
import com.metamatrix.query.sql.lang.SubquerySetCriteria;
+import com.metamatrix.query.sql.lang.TranslatableProcedureContainer;
import com.metamatrix.query.sql.lang.UnaryFromClause;
import com.metamatrix.query.sql.lang.Update;
import com.metamatrix.query.sql.navigator.PostOrderNavigator;
@@ -610,22 +611,12 @@
// get the user's command from the procedure
Command userCmd = procCommand.getUserCommand();
- // check if there is a criteria on user's command, else return
- // a false criteria
- int cmdType = userCmd.getType();
-
- Criteria userCriteria = null;
- switch(cmdType) {
- case Command.TYPE_DELETE:
- userCriteria = ((Delete)userCmd).getCriteria();
- break;
- case Command.TYPE_UPDATE:
- userCriteria = ((Update)userCmd).getCriteria();
- break;
- default:
- return FALSE_CRITERIA;
+ if (!(userCmd instanceof TranslatableProcedureContainer)) {
+ return FALSE_CRITERIA;
}
+ Criteria userCriteria = ((TranslatableProcedureContainer)userCmd).getCriteria();
+
if(userCriteria == null) {
return FALSE_CRITERIA;
}
@@ -660,7 +651,8 @@
// translated criteria
translatedCriteria = translateVisitor.getTranslatedCriteria();
-
+ ((TranslatableProcedureContainer)userCmd).addImplicitParameters(translateVisitor.getImplicitParams());
+
translatedCriteria = rewriteCriteria(translatedCriteria, null, context, metadata);
// apply any implicit conversions
Modified: trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Delete.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Delete.java 2009-07-14 17:38:11 UTC (rev 1127)
+++ trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Delete.java 2009-07-14 20:23:53 UTC (rev 1128)
@@ -37,7 +37,7 @@
* "DELETE FROM <group> [WHERE <criteria>]".
* Implements Command interface.
*/
-public class Delete extends ProcedureContainer {
+public class Delete extends TranslatableProcedureContainer {
/** Identifies the group to delete data from. */
private GroupSymbol group;
Added: trunk/engine/src/main/java/com/metamatrix/query/sql/lang/TranslatableProcedureContainer.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/sql/lang/TranslatableProcedureContainer.java (rev 0)
+++ trunk/engine/src/main/java/com/metamatrix/query/sql/lang/TranslatableProcedureContainer.java 2009-07-14 20:23:53 UTC (rev 1128)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.query.sql.lang;
+
+import java.util.Map;
+
+import com.metamatrix.query.sql.symbol.ElementSymbol;
+import com.metamatrix.query.sql.symbol.Reference;
+
+public abstract class TranslatableProcedureContainer extends ProcedureContainer {
+
+ private Map<ElementSymbol, Reference> implicitParams;
+
+ public void addImplicitParameters(Map<ElementSymbol, Reference> parameters) {
+ if (parameters == null) {
+ return;
+ }
+ if (implicitParams == null) {
+ this.implicitParams = parameters;
+ }
+ this.implicitParams.putAll(parameters);
+ }
+
+ /**
+ * Get the implicit parameters (if any) created by translate criteria
+ * @return
+ */
+ public Map<ElementSymbol, Reference> getImplicitParams() {
+ return implicitParams;
+ }
+
+ public abstract Criteria getCriteria();
+}
Property changes on: trunk/engine/src/main/java/com/metamatrix/query/sql/lang/TranslatableProcedureContainer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Update.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Update.java 2009-07-14 17:38:11 UTC (rev 1127)
+++ trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Update.java 2009-07-14 20:23:53 UTC (rev 1128)
@@ -41,9 +41,9 @@
* Represents a SQL Update statement of the form:
* "UPDATE <group> SET <element> = <expression>, ... [WHERE <criteria>]".
*/
-public class Update extends ProcedureContainer {
+public class Update extends TranslatableProcedureContainer {
- /** Identifies the group to be udpdated. */
+ /** Identifies the group to be updated. */
private GroupSymbol group;
private SetClauseList changeList = new SetClauseList();
Modified: trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/CriteriaTranslatorVisitor.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/CriteriaTranslatorVisitor.java 2009-07-14 17:38:11 UTC (rev 1127)
+++ trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/CriteriaTranslatorVisitor.java 2009-07-14 20:23:53 UTC (rev 1128)
@@ -55,13 +55,13 @@
// criteria selector specified on the TranslateCriteria obj
private CriteriaSelector selector;
- // traslation in for of CompareCriteria objs on the TranslateCriteria obj
+ // translation in for of CompareCriteria objs on the TranslateCriteria obj
private Collection translations;
// list of translated criteria
private List<Criteria> translatedCriteria = new ArrayList<Criteria>();
- private Map<Reference, Reference> impliedParameters = new HashMap<Reference, Reference>();
+ private Map<ElementSymbol, Reference> implicitParams = new HashMap<ElementSymbol, Reference>();
/**
* <p> This constructor initialises the visitor</p>
@@ -71,7 +71,7 @@
}
/**
- * <p> This constructor initialises this object by setting the symbolMap.</p>
+ * <p> This constructor initializes this object by setting the symbolMap.</p>
* @param symbolMap A map of virtual elements to their counterparts in transform
* defining the virtual group
*/
@@ -203,7 +203,7 @@
return false;
} else if(selector.hasElements()) {
Iterator selectElmnIter = selector.getElements().iterator();
- Collection critElmnts = ElementCollectorVisitor.getElements(criteria, true);
+ Collection<ElementSymbol> critElmnts = ElementCollectorVisitor.getElements(criteria, true);
while(selectElmnIter.hasNext()) {
ElementSymbol selectElmnt = (ElementSymbol) selectElmnIter.next();
if(critElmnts.contains(selectElmnt)) {
@@ -221,14 +221,30 @@
Iterator transIter = this.translations.iterator();
while(transIter.hasNext()) {
CompareCriteria compCrit = (CompareCriteria) transIter.next();
- Collection leftElmnts = ElementCollectorVisitor.getElements(compCrit.getLeftExpression(), true);
+ Collection<ElementSymbol> leftElmnts = ElementCollectorVisitor.getElements(compCrit.getLeftExpression(), true);
// there is always only one element
- ElementSymbol element = (ElementSymbol)leftElmnts.iterator().next();
+ ElementSymbol element = leftElmnts.iterator().next();
if(obj.equals(element)) {
return compCrit.getRightExpression();
}
}
}
+ /*
+ * Special handling for references in translated criteria.
+ * We need to create a locally valid reference name.
+ */
+ if (obj instanceof Reference) {
+ Reference implicit = (Reference)obj;
+ ElementSymbol key = null;
+ if (implicit.isPositional()) {
+ key = new ElementSymbol("$INPUT." + implicit.getContextSymbol()); //$NON-NLS-1$
+ } else {
+ key = new ElementSymbol("$INPUT." + implicit.getExpression().getName()); //$NON-NLS-1$
+ }
+ key.setType(implicit.getType());
+ this.implicitParams.put(key, implicit);
+ return new Reference(key);
+ }
return super.replaceExpression(obj);
}
@@ -243,11 +259,15 @@
public Criteria getTranslatedCriteria() {
if(translatedCriteria.size() > 0) {
if(translatedCriteria.size() == 1) {
- return (Criteria) translatedCriteria.get(0);
+ return translatedCriteria.get(0);
}
return new CompoundCriteria(CompoundCriteria.AND, translatedCriteria);
}
return null;
}
-
+
+ public Map<ElementSymbol, Reference> getImplicitParams() {
+ return implicitParams;
+ }
+
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/FakeDataManager.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/FakeDataManager.java 2009-07-14 17:38:11 UTC (rev 1127)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/FakeDataManager.java 2009-07-14 20:23:53 UTC (rev 1128)
@@ -42,6 +42,7 @@
import com.metamatrix.query.sql.lang.ProcedureContainer;
import com.metamatrix.query.sql.lang.Query;
import com.metamatrix.query.sql.lang.SetQuery;
+import com.metamatrix.query.sql.lang.TranslatableProcedureContainer;
import com.metamatrix.query.sql.lang.Update;
import com.metamatrix.query.sql.symbol.AliasSymbol;
import com.metamatrix.query.sql.symbol.ElementSymbol;
@@ -145,7 +146,7 @@
* either came from a BatchedUpdateCommand or a signle
* command from an Update command.
*/
- List<Update> updateCommands = new ArrayList<Update>();
+ List<TranslatableProcedureContainer> updateCommands = new ArrayList<TranslatableProcedureContainer>();
// Apply query criteria to tuples
if(command instanceof Query){
@@ -176,15 +177,15 @@
tuples = new List[filteredTuples.size()];
filteredTuples.toArray(tuples);
}
- } else if ( command instanceof Update ) {
+ } else if ( command instanceof TranslatableProcedureContainer ) {
// add single update command to a list to be executed
- updateCommands.add((Update)command);
+ updateCommands.add((TranslatableProcedureContainer)command);
} else if ( command instanceof BatchedUpdateCommand ) {
if ( ((CommandContainer) command).getContainedCommands() != null && ((CommandContainer) command).getContainedCommands().size() > 0 )
// add all update commands to a list to be executed
for ( int i = 0; i < ((CommandContainer) command).getContainedCommands().size(); i++ )
- if ( ((CommandContainer) command).getContainedCommands().get(i) instanceof Update ) {
- updateCommands.add(((Update) ((CommandContainer) command).getContainedCommands().get(i)));
+ if ( ((CommandContainer) command).getContainedCommands().get(i) instanceof TranslatableProcedureContainer ) {
+ updateCommands.add(((TranslatableProcedureContainer) ((CommandContainer) command).getContainedCommands().get(i)));
}
}
@@ -192,7 +193,7 @@
if ( updateCommands.size() > 0 ) {
List<List<Integer>> filteredTuples = new ArrayList<List<Integer>>();
for ( int c = 0; c < updateCommands.size(); c++ ) {
- Update update = (Update)updateCommands.get(c);
+ TranslatableProcedureContainer update = updateCommands.get(c);
if ( update.getCriteria() != null ) {
// Build lookupMap from BOTH all the elements and the projected symbols - both may be needed here
Map<Object, Integer> lookupMap = new HashMap<Object, Integer>();
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java 2009-07-14 17:38:11 UTC (rev 1127)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java 2009-07-14 20:23:53 UTC (rev 1128)
@@ -444,7 +444,7 @@
}
}
- static void sampleData2b(FakeDataManager dataMgr) {
+ public static void sampleData2b(FakeDataManager dataMgr) {
FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
try {
Modified: trunk/engine/src/test/java/com/metamatrix/query/unittest/FakeMetadataFactory.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/unittest/FakeMetadataFactory.java 2009-07-14 17:38:11 UTC (rev 1127)
+++ trunk/engine/src/test/java/com/metamatrix/query/unittest/FakeMetadataFactory.java 2009-07-14 20:23:53 UTC (rev 1128)
@@ -890,7 +890,7 @@
vm1g1.putProperty(FakeMetadataObject.Props.INSERT_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = INSERT INTO pm1.g1(e2) values(INPUT.e2); END"); //$NON-NLS-1$
vm1g1.putProperty(FakeMetadataObject.Props.UPDATE_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = UPDATE pm1.g1 SET e2 = INPUT.e2; END"); //$NON-NLS-1$
vm1g37.putProperty(FakeMetadataObject.Props.INSERT_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = INSERT INTO pm4.g1(e1, e2, e3, e4) values(INPUT.e1, INPUT.e2, INPUT.e3, INPUT.e4); END"); //$NON-NLS-1$
- vm1g37.putProperty(FakeMetadataObject.Props.DELETE_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = DELETE FROM pm1.g1 where translate criteria; END"); //$NON-NLS-1$
+ vm1g37.putProperty(FakeMetadataObject.Props.DELETE_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = DELETE FROM pm4.g1 where translate criteria; END"); //$NON-NLS-1$
QueryNode vspqn37 = new QueryNode("vsp37", "CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; VARIABLES.x=5; INSERT INTO vm1.g1(e2) values(VARIABLES.x); END"); //$NON-NLS-1$ //$NON-NLS-2$
FakeMetadataObject vsp37 = createVirtualProcedure("pm1.vsp37", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn37); //$NON-NLS-1$
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java 2009-07-14 17:38:11 UTC (rev 1127)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java 2009-07-14 20:23:53 UTC (rev 1128)
@@ -22,13 +22,14 @@
package org.teiid.dqp.internal.process;
+import static org.junit.Assert.*;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
-import junit.framework.TestCase;
-
+import org.junit.Test;
import org.teiid.dqp.internal.process.TestRequest.FakeApplicationEnvironment;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -54,7 +55,7 @@
import com.metamatrix.query.unittest.FakeMetadataFacade;
import com.metamatrix.query.unittest.FakeMetadataFactory;
-public class TestPreparedStatement extends TestCase{
+public class TestPreparedStatement {
private static final int SESSION_ID = 6;
@@ -75,10 +76,6 @@
}
- public TestPreparedStatement(String name) {
- super(name);
- }
-
static void helpTestProcessing(String preparedSql, List values, List[] expected, ProcessorDataManager dataManager, QueryMetadataInterface metadata, boolean callableStatement) throws Exception {
helpTestProcessing(preparedSql, values, expected, dataManager, metadata, callableStatement, false);
}
@@ -146,7 +143,7 @@
assertEquals(exHitCount, pPlanCache.hitCount);
}
- public void testWhere() throws Exception {
+ @Test public void testWhere() throws Exception {
// Create query
String preparedSql = "SELECT pm1.g1.e1, e2, pm1.g1.e3 as a, e4 as b FROM pm1.g1 WHERE e2=?"; //$NON-NLS-1$
@@ -163,7 +160,7 @@
helpTestProcessing(preparedSql, values, expected, dataManager, FakeMetadataFactory.example1Cached(), false);
}
- public void testSessionSpecificFunction() throws Exception {
+ @Test public void testSessionSpecificFunction() throws Exception {
// Create query
String preparedSql = "SELECT user(), e2, pm1.g1.e3 as a, e4 as b FROM pm1.g1 WHERE e2=?"; //$NON-NLS-1$
@@ -180,7 +177,7 @@
helpTestProcessing(preparedSql, values, expected, dataManager, FakeMetadataFactory.example1Cached(), false, true);
}
- public void testFunctionWithReferencePushDown() throws Exception {
+ @Test public void testFunctionWithReferencePushDown() throws Exception {
// Create query
String preparedSql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1 = pm1.g2.e1 and pm1.g1.e2+2=?"; //$NON-NLS-1$
@@ -203,8 +200,7 @@
FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- List values = new ArrayList();
- values.add(new Integer(0));
+ List values = Arrays.asList(0);
PreparedStatementRequest plan = helpGetProcessorPlan(preparedSql, values, capFinder, metadata, new PreparedPlanCache(), SESSION_ID, false, false);
@@ -266,7 +262,7 @@
return serverRequest;
}
- public void testValidateCorrectValues() throws Exception {
+ @Test public void testValidateCorrectValues() throws Exception {
// Create query
String preparedSql = "SELECT pm1.g1.e1, e2, pm1.g1.e3 as a, e4 as b FROM pm1.g1 WHERE pm1.g1.e1=?"; //$NON-NLS-1$
@@ -278,32 +274,29 @@
}
/** SELECT pm1.g1.e1 FROM pm1.g1 WHERE pm1.g1.e2 IN (SELECT pm1.g2.e2 FROM pm1.g2 WHERE pm1.g2.e1 = ?)*/
- public void testWithSubquery() throws Exception {
+ @Test public void testWithSubquery() throws Exception {
// Create query
String preparedSql = "SELECT pm1.g1.e1 FROM pm1.g1 WHERE pm1.g1.e2 IN (SELECT pm1.g2.e2 FROM pm1.g2 WHERE pm1.g2.e1 = ?)"; //$NON-NLS-1$
- List values = new ArrayList();
- values.add("a"); //$NON-NLS-1$
+ List values = Arrays.asList("a"); //$NON-NLS-1$
//Create plan
helpGetProcessorPlan(preparedSql, values, new PreparedPlanCache());
}
/** SELECT pm1.g1.e1 FROM pm1.g1 WHERE pm1.g1.e1 = ? AND pm1.g1.e2 IN (SELECT pm1.g2.e2 FROM pm1.g2 WHERE pm1.g2.e1 = ?) */
- public void testWithSubquery2() throws Exception {
+ @Test public void testWithSubquery2() throws Exception {
// Create query
String preparedSql = "SELECT pm1.g1.e1 FROM pm1.g1 WHERE pm1.g1.e1 = ? AND pm1.g1.e2 IN (SELECT pm1.g2.e2 FROM pm1.g2 WHERE pm1.g2.e1 = ?)"; //$NON-NLS-1$
- List values = new ArrayList();
- values.add("d"); //$NON-NLS-1$
- values.add("c"); //$NON-NLS-1$
+ List values = Arrays.asList("d", "c"); //$NON-NLS-1$ //$NON-NLS-2$
//Create plan
helpGetProcessorPlan(preparedSql, values, new PreparedPlanCache());
}
/** SELECT X.e1 FROM (SELECT pm1.g2.e1 FROM pm1.g2 WHERE pm1.g2.e1 = ?) as X */
- public void testWithSubquery3() throws Exception {
+ @Test public void testWithSubquery3() throws Exception {
// Create query
String preparedSql = "SELECT X.e1 FROM (SELECT pm1.g2.e1 FROM pm1.g2 WHERE pm1.g2.e1 = ?) as X"; //$NON-NLS-1$
@@ -315,7 +308,7 @@
helpGetProcessorPlan(preparedSql, values, new PreparedPlanCache());
}
- public void testValidateWrongValues() throws Exception {
+ @Test public void testValidateWrongValues() throws Exception {
// Create query
String preparedSql = "SELECT pm1.g1.e1, e2, pm1.g1.e3 as a, e4 as b FROM pm1.g1 WHERE pm1.g1.e2=?"; //$NON-NLS-1$
TestablePreparedPlanCache prepCache = new TestablePreparedPlanCache();
@@ -359,13 +352,11 @@
}
- public void testResolveParameterValues() throws Exception {
+ @Test public void testResolveParameterValues() throws Exception {
// Create query
String preparedSql = "SELECT pm1.g1.e1, e2, pm1.g1.e3 as a, e4 as b FROM pm1.g1 WHERE pm1.g1.e2=?"; //$NON-NLS-1$
- List values = new ArrayList();
- //values.add("a");
- values.add("0"); //$NON-NLS-1$
+ List values = Arrays.asList("0"); //$NON-NLS-1$
helpGetProcessorPlan(preparedSql, values, new PreparedPlanCache());
}
@@ -373,12 +364,11 @@
/**
* TODO: there may be other ways of handling this situation in the future
*/
- public void testLimitNoCache() throws Exception {
+ @Test public void testLimitNoCache() throws Exception {
// Create query
String preparedSql = "SELECT pm1.g1.e1, e2, pm1.g1.e3 as a, e4 as b FROM pm1.g1 WHERE pm1.g1.e2=?"; //$NON-NLS-1$
- List values = new ArrayList();
- values.add("0"); //$NON-NLS-1$
+ List values = Arrays.asList("0"); //$NON-NLS-1$
TestablePreparedPlanCache planCache = new TestablePreparedPlanCache();
@@ -388,5 +378,18 @@
//make sure the plan wasn't reused
assertEquals(0, planCache.hitCount);
}
+
+ @Test public void testUpdateProcedureCriteria() throws Exception {
+ String preparedSql = "delete from vm1.g37 where e1=?"; //$NON-NLS-1$
+
+ List[] expected = new List[] {
+ Arrays.asList(1),
+ };
+
+ List values = Arrays.asList("aa "); //$NON-NLS-1$
+ FakeDataManager dataManager = new FakeDataManager();
+ TestProcessor.sampleData2b(dataManager);
+ helpTestProcessing(preparedSql, values, expected, dataManager, FakeMetadataFactory.example1Cached(), false, false);
+ }
}
15 years, 5 months