You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2007/09/10 09:55:17 UTC
svn commit: r574161 - in /incubator/tuscany/java/das/rdb/src:
main/java/org/apache/tuscany/das/rdb/impl/
test/java/org/apache/tuscany/das/rdb/test/ test/resources/
Author: lresende
Date: Mon Sep 10 00:55:17 2007
New Revision: 574161
URL: http://svn.apache.org/viewvc?rev=574161&view=rev
Log:
TUSCANY-1462 - Applying patch from Amita (missed newly added files)
Added:
incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterExtendedImpl.java (with props)
incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParametersExtendedImpl.java (with props)
incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NamedParameterTests.java (with props)
incubator/tuscany/java/das/rdb/src/test/resources/namedParameter.xml (with props)
Added: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterExtendedImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterExtendedImpl.java?rev=574161&view=auto
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterExtendedImpl.java (added)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterExtendedImpl.java Mon Sep 10 00:55:17 2007
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import org.apache.tuscany.das.rdb.Converter;
+import org.apache.tuscany.das.rdb.config.impl.ParameterImpl;
+import commonj.sdo.Type;
+
+public class ParameterExtendedImpl extends ParameterImpl{
+ /**
+ * Value for "Direction" that indicates that a parameter is soley for input.
+ */
+ static final String IN = "IN";
+
+ /**
+ * Value for "Direction" that indicates that a parameter is soley for output.
+ * Out parameters only apply to Stored Procedures
+ */
+ static final String OUT = "OUT";
+
+ /**
+ * Value for "Direction" that indicates that a parameter is for both input and output.
+ * In-out parameters only apply to stored procedures
+ */
+ static final String IN_OUT = "IN_OUT";
+
+ private Type type;
+
+ protected Object value;
+
+ private Converter converter;
+
+ public ParameterExtendedImpl() {
+ super();
+ this.direction = IN;
+ }
+
+ public ParameterExtendedImpl(org.apache.tuscany.das.rdb.config.impl.ParameterImpl parameterImpl) {
+ this.columnType = parameterImpl.getColumnType();
+ this.direction = parameterImpl.getDirection();
+ this.index = parameterImpl.getIndex();
+ this.name = parameterImpl.getName();
+ }
+
+ public void setType(Type type) {
+ this.type = type;
+ }
+
+ public Type getType() {
+ return this.type;
+ }
+
+ public void setColumnType(String newColumnType) {
+ super.setColumnType(newColumnType);
+ if(newColumnType != null){
+ String arg0 = newColumnType.substring(0, newColumnType.lastIndexOf("."));
+ String arg1 = newColumnType.substring(newColumnType.lastIndexOf(".")+1);
+ this.type = SDODataTypes.TYPE_HELPER.getType(arg0, arg1);
+ }
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ public Object getValue() {
+ if (getConverter() != null) {
+ return getConverter().getColumnValue(this.value);
+ }
+
+ return this.value;
+ }
+
+ public void setConverter(Converter converter) {
+ this.converter = converter;
+ }
+
+ public Converter getConverter() {
+ return this.converter;
+ }
+
+}
Propchange: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterExtendedImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterExtendedImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParametersExtendedImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParametersExtendedImpl.java?rev=574161&view=auto
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParametersExtendedImpl.java (added)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParametersExtendedImpl.java Mon Sep 10 00:55:17 2007
@@ -0,0 +1,171 @@
+package org.apache.tuscany.das.rdb.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.log4j.Logger;
+import org.apache.tuscany.das.rdb.config.Parameters;
+import org.apache.tuscany.das.rdb.config.impl.ParameterImpl;
+import org.apache.tuscany.das.rdb.config.impl.ParametersImpl;
+
+import commonj.sdo.Type;
+
+public class ParametersExtendedImpl extends ParametersImpl{
+ private final Logger logger = Logger.getLogger(ParametersExtendedImpl.class);
+ private List inParams = new ArrayList();
+
+ private List outParams = new ArrayList();
+
+ public ParametersExtendedImpl(){
+
+ }
+
+ public ParametersExtendedImpl(List paramsList) {
+ if(this.parameter == null){
+ this.parameter = new ArrayList();
+ }
+ if(paramsList != null){
+ for(int i=0; i<paramsList.size(); i++){
+ ParameterImpl paramImpl = (ParameterImpl)paramsList.get(i);
+ ParameterExtendedImpl paramExtImpl = new ParameterExtendedImpl();
+ paramExtImpl.setColumnType(paramImpl.getColumnType());
+ paramExtImpl.setIndex(paramImpl.getIndex());
+ paramExtImpl.setName(paramImpl.getName());
+ paramExtImpl.setDirection(paramImpl.getDirection());
+ this.parameter.add(paramExtImpl);
+ }
+ }
+ }
+
+ public ParametersExtendedImpl(Parameters params) {
+ this(params.getParameter());
+ }
+
+ public List getOutParameters() {
+ return outParams;
+ }
+
+ public List getInParameters() {
+ return inParams;
+ }
+
+ public ParameterExtendedImpl getParameter(int index) {
+ if(this.getParameter() == null || this.getParameter().isEmpty())
+ return null;
+
+ Iterator itr = this.getParameter().iterator();
+ while(itr.hasNext()){
+ ParameterExtendedImpl curParam = (ParameterExtendedImpl)itr.next();
+ if(curParam.getIndex() == index){
+ return curParam;
+ }
+ }
+ return null;
+ }
+
+ public ParameterExtendedImpl getParameter(int index, String direction) {
+ if(direction.equals(ParameterExtendedImpl.IN)) {
+ Iterator itr = this.inParams.iterator();
+ while(itr.hasNext()){
+ ParameterExtendedImpl curParam = (ParameterExtendedImpl)itr.next();
+ if(curParam.getIndex() == index){
+ return curParam;
+ }
+ }
+ }
+ else {
+ Iterator itr = this.outParams.iterator();
+ while(itr.hasNext()){
+ ParameterExtendedImpl curParam = (ParameterExtendedImpl)itr.next();
+ if(curParam.getIndex() == index){
+ return curParam;
+ }
+ }
+ }
+ return null;
+ }
+
+ private ParameterExtendedImpl getNamedParameter(List params, String name){
+ if(params == null)
+ return null;
+ for(int i=0; i<params.size(); i++){
+ if( ((ParameterExtendedImpl)params.get(i)).getName().equals(name)){
+ return (ParameterExtendedImpl)params.get(i);
+ }
+ }
+ return null;
+ }
+
+ public ParameterExtendedImpl getParameter(String name) {
+ return getNamedParameter(this.getParameter(), name);
+ }
+
+ public ParameterExtendedImpl getParameter(String name, String direction) {
+ if(direction.equals(ParameterExtendedImpl.IN))
+ return getNamedParameter(this.inParams, name);
+ else
+ return getNamedParameter(this.outParams, name);
+ }
+
+ public ParameterExtendedImpl findOrCreateParameterWithIndex(int index, String direction, Type sdoType) {
+ if(this.parameter == null){
+ this.parameter = new ArrayList();
+ }
+ Iterator i = this.parameter.iterator();
+ while (i.hasNext()) {
+ ParameterExtendedImpl param = (ParameterExtendedImpl) i.next();
+
+ if (param.getIndex() == index) {
+ return param;
+ }
+ }
+ if (this.logger.isDebugEnabled()) {
+ this.logger.debug("Creating new parameter with index " + index);
+ }
+
+ ParameterExtendedImpl newParam = new ParameterExtendedImpl();
+ newParam.setIndex(index);
+ newParam.setDirection(direction);
+ newParam.setType(sdoType);
+ newParam.setColumnType(SDODataTypeHelper.columnTypeForSDOType(sdoType));
+ this.getParameter().add(newParam);
+ if(!direction.equals(ParameterExtendedImpl.IN)){
+ this.getOutParameters().add(newParam);
+ }
+ else{
+ this.getInParameters().add(newParam);
+ }
+ return newParam;
+ }
+
+ /**maintain compatibility with parameters="name1 name2 " from config
+ *
+ * @param parameters
+ */
+ public static ArrayList getParameters(String parameters) {
+ StringTokenizer tokenizer = new StringTokenizer(parameters);
+ ArrayList paramExtList = new ArrayList();
+ for (int idx = 1; tokenizer.hasMoreTokens(); idx++) {
+ ParameterExtendedImpl p = new ParameterExtendedImpl();
+ p.setName(tokenizer.nextToken());
+ p.setIndex(idx);
+ p.setDirection(ParameterExtendedImpl.IN);
+ paramExtList.add(p);
+ }
+ return paramExtList;
+ }
+
+ public void addParameters(List paramExtList){
+ for(int i=0; i<paramExtList.size(); i++){
+ ParameterExtendedImpl curParam = (ParameterExtendedImpl)paramExtList.get(i);
+ this.getParameter().add(curParam);
+ if(curParam.getDirection().equals(ParameterExtendedImpl.IN))
+ this.getInParameters().add(paramExtList.get(i));
+ else
+ this.getOutParameters().add(paramExtList.get(i));
+ }
+ }
+
+}
Propchange: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParametersExtendedImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParametersExtendedImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NamedParameterTests.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NamedParameterTests.java?rev=574161&view=auto
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NamedParameterTests.java (added)
+++ incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NamedParameterTests.java Mon Sep 10 00:55:17 2007
@@ -0,0 +1,248 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.ConfigHelper;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.config.ConfigFactory;
+import org.apache.tuscany.das.rdb.config.Create;
+import org.apache.tuscany.das.rdb.config.Delete;
+import org.apache.tuscany.das.rdb.config.Parameter;
+import org.apache.tuscany.das.rdb.config.Parameters;
+import org.apache.tuscany.das.rdb.config.Table;
+import org.apache.tuscany.das.rdb.config.Update;
+import org.apache.tuscany.das.rdb.test.data.BookData;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class NamedParameterTests extends DasTest {
+ protected void setUp() throws Exception {
+ super.setUp();
+ new CustomerData(getAutoConnection()).refresh();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test passing <Parameters><Parameter></Paramerers> to create/update/delete
+ * through config, with duplicate indexes
+ * @throws Exception
+ */
+ public void testCUDNamedParameters() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("namedParameter.xml"), getConnection());
+ // Read customer 1
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
+ DataObject root = select.executeQuery();
+ assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick"));
+
+ // Modify customer
+ DataObject customer = (DataObject) root.get("CUSTOMER[1]");
+ customer.set("LASTNAME", "Pavick");
+ customer.set("ADDRESS", "Pavick's Address");
+ // Build apply changes command
+ try{
+ das.applyChanges(root);
+ fail("Expected exception");
+ }catch(RuntimeException e){
+ assertTrue(e.getMessage().startsWith("Parameters with improper indexes!"));
+ }
+
+ //create
+ root = select.executeQuery();
+ DataObject newCustomer = root.createDataObject("CUSTOMER");
+ newCustomer.setInt("ID", 6);
+ newCustomer.setString("LASTNAME", "Louise");
+ newCustomer.setString("ADDRESS", "U.K.");
+ try{
+ das.applyChanges(root);
+ fail("Expected exception");
+ }catch(RuntimeException e){
+ assertTrue(e.getMessage().startsWith("Parameters with duplicate indexes!"));
+ }
+
+ //delete
+ root = select.executeQuery();
+ DataObject toBeDeleted = root.getDataObject("CUSTOMER[1]");
+ toBeDeleted.setString("LASTNAME", "Pavick");
+ toBeDeleted.delete();
+ das.applyChanges(root);
+ root = select.executeQuery();
+ assertEquals(null, root.getDataObject("CUSTOMER[1]"));
+
+ }
+
+ /**
+ * Test passing <Parameter>List to Command through config
+ * @throws Exception
+ */
+ public void testCommandNamedParameters() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("namedParameter.xml"), getConnection());
+ //select
+ Command select = das.getCommand("getCustomer");
+ select.setParameter("ID", new Integer(1));
+ DataObject root = select.executeQuery();
+ List customers = root.getList("CUSTOMER");
+ assertEquals(1, customers.size());
+ DataObject customer = (DataObject)customers.get(0);
+ assertEquals("Williams", customer.get("LASTNAME"));
+
+ //insert - command in config has <Parameter>
+ Command insert = das.getCommand("createCustomer");
+ //see order is not maintained, but config depicts it through index attrb
+ //if index is missing , auto increment logic will be followed
+ insert.setParameter("LASTNAME", "Louise");
+ insert.setParameter("ADDRESS", "TPO");
+ insert.setParameter("ID", new Integer(6));
+ insert.execute();
+ select.setParameter("ID", new Integer(6));
+ root = select.executeQuery();
+ customers = root.getList("CUSTOMER");
+ assertEquals(1, customers.size());
+ customer = (DataObject)customers.get(0);
+ assertEquals("Louise", customer.get("LASTNAME"));
+
+ //insert - command in config has no <Parameter>
+ Command insertNoParam = das.getCommand("createCustomerNoParam");
+ //if param/index is missing in cfg, auto increment logic will be followed
+ insertNoParam.setParameter("ID", new Integer(7));
+ insertNoParam.setParameter("LASTNAME", "Louise7");
+ insertNoParam.setParameter("ADDRESS", "TPO7");
+ insertNoParam.execute();
+ select.setParameter("ID", new Integer(7));
+ root = select.executeQuery();
+ customers = root.getList("CUSTOMER");
+ assertEquals(1, customers.size());
+ customer = (DataObject)customers.get(0);
+ assertEquals("Louise7", customer.get("LASTNAME"));
+
+ //update
+ Command update = das.getCommand("updateCustomer");
+ update.setParameter("LASTNAME", "NoLouise");
+ update.setParameter("ID", new Integer(6));
+ update.execute();
+ select.setParameter("ID", new Integer(6));
+ root = select.executeQuery();
+ customers = root.getList("CUSTOMER");
+ assertEquals(1, customers.size());
+ customer = (DataObject)customers.get(0);
+ assertEquals("NoLouise", customer.get("LASTNAME"));
+
+ //update - no param in config
+ Command updateNoParam = das.getCommand("updateCustomerNoParam");
+ updateNoParam.setParameter("LASTNAME", "YesLouise");
+ updateNoParam.setParameter("ID", new Integer(6));
+ updateNoParam.execute();
+ select.setParameter("ID", new Integer(6));
+ root = select.executeQuery();
+ customers = root.getList("CUSTOMER");
+ assertEquals(1, customers.size());
+ customer = (DataObject)customers.get(0);
+ assertEquals("YesLouise", customer.get("LASTNAME"));
+
+ //delete
+ Command delete = das.getCommand("deleteCustomer");
+ delete.setParameter("ID", new Integer(6));
+ delete.execute();
+ select.setParameter("ID", new Integer(6));
+ root = select.executeQuery();
+ customers = root.getList("CUSTOMER");
+ assertEquals(0, customers.size());
+
+ //delete - cfg command with no param
+ Command deleteNoParam = das.getCommand("deleteCustomerNoParam");
+ deleteNoParam.setParameter("ID", new Integer(7));
+ deleteNoParam.execute();
+ select.setParameter("ID", new Integer(7));
+ root = select.executeQuery();
+ customers = root.getList("CUSTOMER");
+ assertEquals(0, customers.size());
+ }
+
+ /**
+ * Test passing <Parameter>List to Command through program
+ * @throws Exception
+ */
+ public void testProgrammaticCommandNamedParameters() throws Exception {
+ ConfigHelper helper = new ConfigHelper();
+ //Command insertAdhoc = das.createCommand("insert into CUSTOMER values (?, ?, ?)");
+ org.apache.tuscany.das.rdb.config.Command insertAdhoc = ConfigFactory.INSTANCE.createCommand();
+ insertAdhoc.setKind("insert");
+ insertAdhoc.setSQL("insert into CUSTOMER values (?, ?, ?)");
+ insertAdhoc.setName("insertCustomer");
+ Parameter parameter1 = ConfigFactory.INSTANCE.createParameter();
+ parameter1.setName("ID");
+ Parameter parameter2 = ConfigFactory.INSTANCE.createParameter();
+ parameter2.setName("LASTNAME");
+ Parameter parameter3 = ConfigFactory.INSTANCE.createParameter();
+ parameter3.setName("ADDRESS");
+ insertAdhoc.getParameter().add(parameter1);
+ insertAdhoc.getParameter().add(parameter2);
+ insertAdhoc.getParameter().add(parameter3);
+ Config cfg = helper.getConfig();
+ cfg.getCommand().add(insertAdhoc);
+ DAS das = DAS.FACTORY.createDAS(cfg, getConnection());
+
+ //setup is over, now set values in params and execute
+ Command insert = das.getCommand("insertCustomer");
+ insert.setParameter("ID", new Integer(6));
+ insert.setParameter("LASTNAME", "Anthony");
+ insert.setParameter("ADDRESS", "IND");
+ insert.execute();
+
+ Command select = das.createCommand("select * from CUSTOMER where ID = ?");
+ select.setParameter("ID", new Integer(6));
+ DataObject root = select.executeQuery();
+ List customers = root.getList("CUSTOMER");
+ assertEquals(1, customers.size());
+ DataObject customer = (DataObject)customers.get(0);
+ assertEquals("Anthony", customer.get("LASTNAME"));
+ }
+
+ /**
+ * Test set/getParameter(name) on Command
+ * @throws Exception
+ */
+ public void testNamedParameters() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insertAdhoc = das.createCommand("insert into CUSTOMER values (?, ?, ?)");
+ insertAdhoc.setParameter("ID", new Integer(6));
+ insertAdhoc.setParameter("LASTNAME", "MyLastName");
+ insertAdhoc.setParameter("ADDRESS", "MyLastAddress");
+ assertEquals("MyLastAddress", insertAdhoc.getParameter("ADDRESS"));
+ insertAdhoc.execute();
+
+ Command select = das.createCommand("select * from CUSTOMER where ID = ?");
+ select.setParameter("ID", new Integer(6));
+ DataObject root = select.executeQuery();
+ List customers = root.getList("CUSTOMER");
+ assertEquals(1, customers.size());
+ DataObject customer = (DataObject)customers.get(0);
+ assertEquals("MyLastName", customer.get("LASTNAME"));
+
+ }
+}
Propchange: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NamedParameterTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NamedParameterTests.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/das/rdb/src/test/resources/namedParameter.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/resources/namedParameter.xml?rev=574161&view=auto
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/resources/namedParameter.xml (added)
+++ incubator/tuscany/java/das/rdb/src/test/resources/namedParameter.xml Mon Sep 10 00:55:17 2007
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
+
+ <Table tableName="CUSTOMER">
+ <create sql="insert into customer values (?, ?, ?)" >
+ <Parameters>
+ <Parameter name="ID" index="1"/>
+ <Parameter name="LASTNAME" index="1"/>
+ <Parameter name="ADDRESS" index="3"/>
+ </Parameters>
+ </create>
+
+ <update sql="update customer set lastname = ?, address = ? where ID = ?" >
+ <Parameters>
+ <Parameter name="LASTNAME" index="1"/>
+ <Parameter name="ADDRESS" index="2"/>
+ <Parameter name="ID" index="5"/>
+ </Parameters>
+ </update>
+
+ <delete sql="delete from customer where ID = ? and LASTNAME = ?">
+ <Parameters>
+ <Parameter name="LASTNAME" columnType="commonj.sdo.String" index="2"/>
+ <Parameter name="ID" columnType="commonj.sdo.IntObject" index="1"/>
+ </Parameters>
+ </delete>
+ </Table>
+
+ <Command name="getCustomer" SQL="Select * from CUSTOMER where ID = ?" kind="Select">
+ <Parameter name="ID" index="1"/>
+ </Command>
+
+ <Command name="createCustomer" SQL="insert into CUSTOMER values ( ?, ?, ?)" kind="Insert">
+ <Parameter name="ID" index="1"/>
+ <Parameter name="LASTNAME" index="2"/>
+ <Parameter name="ADDRESS" index="3"/>
+ </Command>
+
+ <Command name="createCustomerNoParam" SQL="insert into CUSTOMER values ( ?, ?, ?)" kind="Insert"/>
+
+ <Command name="updateCustomer" SQL="update CUSTOMER set LASTNAME = ? where ID = ?" kind="Update">
+ <Parameter name="LASTNAME" index="1"/>
+ <Parameter name="ID" index="2"/>
+ </Command>
+
+ <Command name="updateCustomerNoParam" SQL="update CUSTOMER set LASTNAME = ? where ID = ?" kind="Update">
+ </Command>
+
+ <Command name="deleteCustomer" SQL="delete from CUSTOMER where ID = ?" kind="Delete">
+ <Parameter name="ID" index="1"/>
+ </Command>
+
+ <Command name="deleteCustomerNoParam" SQL="delete from CUSTOMER where ID = ?" kind="Delete"/>
+
+</Config>
Propchange: incubator/tuscany/java/das/rdb/src/test/resources/namedParameter.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/das/rdb/src/test/resources/namedParameter.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/das/rdb/src/test/resources/namedParameter.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org