[teiid-commits] teiid SVN: r2682 - in trunk: client/src/main/java/org/teiid/jdbc and 39 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Oct 26 10:11:13 EDT 2010


Author: shawkins
Date: 2010-10-26 10:11:06 -0400 (Tue, 26 Oct 2010)
New Revision: 2682

Added:
   trunk/engine/src/test/resources/encoding.xml
Modified:
   trunk/build/kits/jboss-container/teiid-examples/jca/readme.txt
   trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
   trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java
   trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
   trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
   trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java
   trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java
   trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleConvertModifier.java
   trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/postgresql/TestPostgreSQLTranslator.java
   trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sybase/TestSybaseConvertModifier.java
   trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
   trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
   trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
   trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushLimit.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java
   trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/command/DeleteResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateResolver.java
   trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
   trunk/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java
   trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
   trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
   trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java
   trunk/engine/src/main/resources/org/teiid/query/i18n.properties
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
   trunk/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java
   trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
   trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
   trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
   trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
   trunk/metadata/src/main/resources/System.vdb
   trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
   trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
   trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
   trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
   trunk/test-integration/common/src/test/resources/TestCase3473/testGetTables.expected
   trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables.expected
   trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_allTables.expected
   trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableMultipleTypes.expected
   trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableTypes.expected
   trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testTables.expected
   trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected
   trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTableIsSystem.expected
   trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected
   trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testVDBResources.expected
Log:
forward merge of 7.1.1 in preparation for cr1

Modified: trunk/build/kits/jboss-container/teiid-examples/jca/readme.txt
===================================================================
--- trunk/build/kits/jboss-container/teiid-examples/jca/readme.txt	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/build/kits/jboss-container/teiid-examples/jca/readme.txt	2010-10-26 14:11:06 UTC (rev 2682)
@@ -1,8 +1,8 @@
-This folder contains the sample "-ds.xml" files that can be created for Teiid sources.
+This directory contains examples of data source configuration files for the following types of sources:
+    flat files
+    LDAP
+    SalesForce
+    Web Services (for ws-security see Admin Guide)
 
-JDBC: Please check "<jboss-as>/docs/examples/jca" directory for creating a -ds.xml file for any type of relational database. 
-Please note you can find samples for creating both "local" and "xa" data sources.
-
-Web Serivices with ws-security: Check out Admin guide for a sample with explanation on how to use it. 
-
-All the others types of sources, please find a example in this directory.
\ No newline at end of file
+JDBC Users: Please see the examples in the "<jboss-as>/docs/examples/jca" directory for creating data source configuration 
+files for any type of relational database. These examples demonstrate creating both "local" and "xa" data sources.

Modified: trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -532,12 +532,10 @@
             parameterMap = new TreeMap<Integer, Object>();
         }
         
-        Object val = null;
         if (serverCalendar != null && value instanceof java.util.Date) {
-            val = TimestampWithTimezone.create((java.util.Date)value, getDefaultCalendar().getTimeZone(), serverCalendar, value.getClass());
-        } else val = value;
-
-        parameterMap.put(parameterIndex, val);
+            value = TimestampWithTimezone.create((java.util.Date)value, getDefaultCalendar().getTimeZone(), serverCalendar, value.getClass());
+        }
+        parameterMap.put(parameterIndex, value);
     }
 
     /**

Modified: trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -89,14 +89,17 @@
     	if (cs != null) {
     		return cs;
     	}
+    	String enc = null;
     	try {
-			String enc = XMLType.getEncoding(this.getBinaryStream());
-			if (enc != null) {
-				setEncoding(enc);
-			}
+			enc = XMLType.getEncoding(this.getBinaryStream());
 		} catch (SQLException e) {
 		}
-    	return Streamable.CHARSET;
+		if (enc != null) {
+			setEncoding(enc);
+		} else {
+			super.setCharset(Streamable.CHARSET);
+		}
+    	return super.getCharset();
     }
     
     @SuppressWarnings("unchecked")

Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -817,6 +817,11 @@
             stmt.setTimestamp(i,(java.sql.Timestamp)param, getDatabaseCalendar());
             return;
         }
+        //not all drivers handle the setObject call with BigDecimal correctly (namely jConnect 6.05)
+        if (TypeFacility.RUNTIME_TYPES.BIG_DECIMAL.equals(paramType)) {
+        	stmt.setBigDecimal(i, (BigDecimal)param);
+            return;
+        }
         //convert these the following to jdbc safe values
         if (TypeFacility.RUNTIME_TYPES.BIG_INTEGER.equals(paramType)) {
             param = new BigDecimal((BigInteger)param);
@@ -824,7 +829,8 @@
             param = new Double(((Float)param).doubleValue());
         } else if (TypeFacility.RUNTIME_TYPES.CHAR.equals(paramType)) {
             param = ((Character)param).toString();
-        }
+        } 
+        
         stmt.setObject(i, param, type);
     }
     

Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -150,11 +150,9 @@
 				//if column and type is date, just use date format
 				Expression ex = function.getParameters().get(0);
 				String format = TIMESTAMP_FORMAT; 
-				if (ex instanceof ColumnReference) {
-					if ("date".equals(((ColumnReference)ex).getMetadataObject().getNativeType())) { //$NON-NLS-1$
-						format = DATETIME_FORMAT; 
-					}
-				} else if (!(ex instanceof Function) && !(ex instanceof Literal)) {
+				if (ex instanceof ColumnReference && "date".equalsIgnoreCase(((ColumnReference)ex).getMetadataObject().getNativeType())) { //$NON-NLS-1$
+					format = DATETIME_FORMAT; 
+				} else if (!(ex instanceof Literal) && !(ex instanceof Function)) {
 					//this isn't needed in every case, but it's simpler than inspecting the expression more
 					ex = ConvertModifier.createConvertFunction(getLanguageFactory(), function.getParameters().get(0), TypeFacility.RUNTIME_NAMES.TIMESTAMP);
 				}

Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -140,7 +140,7 @@
 		});
     	convertModifier.addConvert(FunctionModifier.DATE, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "YYYY-MM-DD")); //$NON-NLS-1$ //$NON-NLS-2$
     	convertModifier.addConvert(FunctionModifier.TIME, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "HH24:MI:SS")); //$NON-NLS-1$ //$NON-NLS-2$
-    	convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "YYYY-MM-DD HH24:MI:SS.UF")); //$NON-NLS-1$ //$NON-NLS-2$
+    	convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "YYYY-MM-DD HH24:MI:SS.US")); //$NON-NLS-1$ //$NON-NLS-2$
     	convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.STRING, new FunctionModifier() {
 			@Override
 			public List<?> translate(Function function) {

Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -181,7 +181,7 @@
 	protected List<?> convertTimestampToString(Function function) {
 		LinkedList<Object> result = new LinkedList<Object>();
 		result.addAll(convertDateToString(function));
-		result.add(' ');
+		result.add('+');
 		result.addAll(convertTimeToString(function));
 		return result;
 	}

Modified: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleConvertModifier.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleConvertModifier.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleConvertModifier.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -34,6 +34,7 @@
 import org.teiid.language.Expression;
 import org.teiid.language.Function;
 import org.teiid.language.LanguageFactory;
+import org.teiid.metadata.Column;
 import org.teiid.query.unittest.TimestampUtil;
 import org.teiid.translator.TypeFacility;
 import org.teiid.translator.jdbc.SQLConversionVisitor;
@@ -41,6 +42,7 @@
 
 /**
  */
+ at SuppressWarnings("nls")
 public class TestOracleConvertModifier {
 
     private static final LanguageFactory LANG_FACTORY = new LanguageFactory();
@@ -500,6 +502,13 @@
         Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 10000000);        
         helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "to_char({ts '2003-11-01 12:05:02.01'}, 'YYYY-MM-DD HH24:MI:SS.FF')"); //$NON-NLS-1$ //$NON-NLS-2$
     }
+    
+    @Test public void testTimestampToString1() throws Exception {
+    	Column column = new Column();
+    	column.setNativeType("DATE");
+    	column.setNameInSource("dt");
+        helpTest(LANG_FACTORY.createColumnReference("dt", LANG_FACTORY.createNamedTable("x", null, null), column, Timestamp.class), "string", "to_char(x.dt, 'YYYY-MM-DD HH24:MI:SS')"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
 
     @Test public void testTimestampToDate() throws Exception {
         Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 10000000);        

Modified: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/postgresql/TestPostgreSQLTranslator.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/postgresql/TestPostgreSQLTranslator.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/postgresql/TestPostgreSQLTranslator.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -158,7 +158,7 @@
     }
     @Test public void testConversion13() throws Exception {
         String input = "SELECT convert(convert(PART_WEIGHT, timestamp), string) FROM PARTS"; //$NON-NLS-1$
-        String output = "SELECT to_char(cast(PARTS.PART_WEIGHT AS timestamp), 'YYYY-MM-DD HH24:MI:SS.UF') FROM PARTS";  //$NON-NLS-1$
+        String output = "SELECT to_char(cast(PARTS.PART_WEIGHT AS timestamp), 'YYYY-MM-DD HH24:MI:SS.US') FROM PARTS";  //$NON-NLS-1$
 
         helpTestVisitor(getTestVDB(),
             input, 

Modified: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sybase/TestSybaseConvertModifier.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sybase/TestSybaseConvertModifier.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sybase/TestSybaseConvertModifier.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -185,7 +185,7 @@
                 LANG_FACTORY.createLiteral("string", String.class)}, //$NON-NLS-1$
             String.class);
 
-        helpGetString1(func,  "stuff(stuff(convert(varchar, CAST('2003-11-01 12:05:02.0' AS DATETIME), 102), 5, 1, '-'), 8, 1, '-') convert(varchar, CAST('2003-11-01 12:05:02.0' AS DATETIME), 8)");  //$NON-NLS-1$
+        helpGetString1(func,  "stuff(stuff(convert(varchar, CAST('2003-11-01 12:05:02.0' AS DATETIME), 102), 5, 1, '-'), 8, 1, '-')+convert(varchar, CAST('2003-11-01 12:05:02.0' AS DATETIME), 8)");  //$NON-NLS-1$
     }
     
     @Test public void testDateToString() throws Exception {

Modified: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml	2010-10-26 14:11:06 UTC (rev 2682)
@@ -335,19 +335,6 @@
                         </entry>
                         <entry>Name given to this data source</entry>
                     </row>  
-                    <row>
-                        <entry>
-                            <code>PassthroughAuthentication</code>
-                        </entry>
-                        <entry>
-                            <code>boolean</code>
-                        </entry>
-                        <entry>Only applies to "local" connections. When this option is set to "true", then Teiid looks for 
-                        already authenticated security context on the calling thread. If one found it uses that users credentials 
-                        to create session. Teiid also verifies that the same user is using this connection during the life of the connection.
-                        if it finds a different security context on the calling thread, it switches the identity on the connection,
-                        if the new user is also eligible to log in to Teiid otherwise connection fails to execute.</entry>
-                    </row>                     
                                                                                                                                                            
                 </tbody>
             </tgroup>

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -657,10 +657,8 @@
 			}
         }
         Class<?> returnType = null;
-        List parameters = sp.getParameters();
         List<Argument> translatedParameters = new ArrayList<Argument>();
-        for (Iterator i = parameters.iterator(); i.hasNext();) {
-        	SPParameter param = (SPParameter)i.next();
+        for (SPParameter param : sp.getParameters()) {
         	Direction direction = Direction.IN;
             switch(param.getParameterType()) {
                 case ParameterInfo.IN:    
@@ -676,13 +674,15 @@
                     continue; //already part of the metadata
                 case ParameterInfo.RETURN_VALUE: 
                 	returnType = param.getClassType();
-                	break;
-                    
+                	continue;
             }
             
             ProcedureParameter metadataParam = metadataFactory.getParameter(param);
             //we can assume for now that all arguments will be literals, which may be multivalued
-            Literal value = (Literal)translate(param.getExpression());
+            Literal value = null;
+            if (direction != Direction.OUT) {
+            	value = (Literal)translate(param.getExpression());
+            }
             Argument arg = new Argument(direction, value, param.getClassType(), metadataParam);
             translatedParameters.add(arg);
         }

Modified: trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -41,7 +41,6 @@
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
 
-import net.sf.saxon.om.SequenceIterator;
 import net.sf.saxon.trans.XPathException;
 
 import org.teiid.api.exception.query.ExpressionEvaluationException;
@@ -110,6 +109,7 @@
 import org.teiid.query.sql.util.ValueIteratorSource;
 import org.teiid.query.util.CommandContext;
 import org.teiid.query.xquery.saxon.SaxonXQueryExpression;
+import org.teiid.query.xquery.saxon.SaxonXQueryExpression.Result;
 import org.teiid.translator.WSConnection.Util;
 
 public class Evaluator {
@@ -761,13 +761,18 @@
 		if (xmlQuery.getEmptyOnEmpty() != null)  {
 			emptyOnEmpty = xmlQuery.getEmptyOnEmpty();
 		}   
+		Result result = null;
 		try {
-			SequenceIterator iter = evaluateXQuery(xmlQuery.getXQueryExpression(), xmlQuery.getPassing(), tuple);
-			return xmlQuery.getXQueryExpression().createXMLType(iter, this.context.getBufferManager(), emptyOnEmpty);
+			result = evaluateXQuery(xmlQuery.getXQueryExpression(), xmlQuery.getPassing(), tuple);
+			return xmlQuery.getXQueryExpression().createXMLType(result.iter, this.context.getBufferManager(), emptyOnEmpty);
 		} catch (TeiidProcessingException e) {
 			throw new FunctionExecutionException(e, QueryPlugin.Util.getString("Evaluator.xmlquery", e.getMessage())); //$NON-NLS-1$
 		} catch (XPathException e) {
 			throw new FunctionExecutionException(e, QueryPlugin.Util.getString("Evaluator.xmlquery", e.getMessage())); //$NON-NLS-1$
+		} finally {
+			if (result != null) {
+				result.close();
+			}
 		}
 	}
 	
@@ -837,7 +842,7 @@
 		   }
 	}
 	
-	public SequenceIterator evaluateXQuery(SaxonXQueryExpression xquery, List<DerivedColumn> cols, List<?> tuple) 
+	public Result evaluateXQuery(SaxonXQueryExpression xquery, List<DerivedColumn> cols, List<?> tuple) 
 	throws BlockedException, TeiidComponentException, TeiidProcessingException {
 		HashMap<String, Object> parameters = new HashMap<String, Object>();
 		Object contextItem = null;

Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -783,10 +783,22 @@
         	path = path.replace(File.separatorChar, '/');
         }
         for (String string : schemaPaths) {
-        	SQLXMLImpl schema = getVDBResourceAsSQLXML(string);
-        	
+        	String parentPath = path;
+        	boolean relative = false;
+        	while (string.startsWith("../")) { //$NON-NLS-1$
+        		relative = true;
+        		string = string.substring(3);
+        		parentPath = new File(parentPath).getParent();
+        	}
+        	SQLXMLImpl schema = null;
+        	if (!relative) {
+        		schema = getVDBResourceAsSQLXML(string);
+        	}
         	if (schema == null) {
-        		schema = getVDBResourceAsSQLXML(path + '/' + string);
+        		if (!parentPath.endsWith("/")) { //$NON-NLS-1$
+        			parentPath += "/"; //$NON-NLS-1$
+        		}
+        		schema = getVDBResourceAsSQLXML(parentPath + string);
         	}
         	
         	if (schema == null) {

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -82,6 +82,7 @@
 import org.teiid.query.sql.lang.JoinType;
 import org.teiid.query.sql.lang.OrderBy;
 import org.teiid.query.sql.lang.Query;
+import org.teiid.query.sql.lang.QueryCommand;
 import org.teiid.query.sql.lang.StoredProcedure;
 import org.teiid.query.sql.lang.TableFunctionReference;
 import org.teiid.query.sql.lang.TextTable;
@@ -319,13 +320,15 @@
                         aNode.setShouldEvaluateExpressions(EvaluatableVisitor.needsProcessingEvaluation(command));
                     }
                     
-                    try {
-                        command = (Command)command.clone();
-                        boolean aliasGroups = modelID != null && CapabilitiesUtil.supportsGroupAliases(modelID, metadata, capFinder);
-                        boolean aliasColumns = modelID != null && CapabilitiesUtil.supports(Capability.QUERY_SELECT_EXPRESSION, modelID, metadata, capFinder);
-                        command.acceptVisitor(new AliasGenerator(aliasGroups, !aliasColumns));
-                    } catch (QueryMetadataException err) {
-                        throw new TeiidComponentException(err);
+                    if (command instanceof QueryCommand) {
+	                    try {
+	                        command = (Command)command.clone();
+	                        boolean aliasGroups = modelID != null && CapabilitiesUtil.supportsGroupAliases(modelID, metadata, capFinder);
+	                        boolean aliasColumns = modelID != null && CapabilitiesUtil.supports(Capability.QUERY_SELECT_EXPRESSION, modelID, metadata, capFinder);
+	                        command.acceptVisitor(new AliasGenerator(aliasGroups, !aliasColumns));
+	                    } catch (QueryMetadataException err) {
+	                        throw new TeiidComponentException(err);
+	                    }
                     }
                     aNode.setCommand(command);
                     aNode.setModelName(getRoutingName(node));

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -61,6 +61,7 @@
 import org.teiid.query.optimizer.relational.plantree.NodeConstants.Info;
 import org.teiid.query.optimizer.relational.rules.CapabilitiesUtil;
 import org.teiid.query.optimizer.relational.rules.CriteriaCapabilityValidatorVisitor;
+import org.teiid.query.optimizer.relational.rules.RuleCollapseSource;
 import org.teiid.query.optimizer.relational.rules.RuleConstants;
 import org.teiid.query.parser.QueryParser;
 import org.teiid.query.processor.ProcessorPlan;
@@ -538,12 +539,6 @@
 	private void addNestedProcedure(PlanNode sourceNode,
 			ProcedureContainer container) throws TeiidComponentException,
 			QueryMetadataException, TeiidProcessingException {
-		//plan any subqueries in criteria/parameters/values
-		for (SubqueryContainer subqueryContainer : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(container)) {
-    		ProcessorPlan plan = QueryOptimizer.optimizePlan(subqueryContainer.getCommand(), metadata, null, capFinder, analysisRecord, context);
-    		subqueryContainer.getCommand().setProcessorPlan(plan);
-		}
-		
 		String cacheString = "transformation/" + container.getClass().getSimpleName(); //$NON-NLS-1$
 		Command c = (Command)metadata.getFromMetadataCache(container.getGroup().getMetadataID(), cacheString);
 		if (c == null) {
@@ -579,6 +574,20 @@
 			//so that we know what the determinism level is.
 			addNestedCommand(sourceNode, container.getGroup(), container, c, false);
 		}
+		//plan any subqueries in criteria/parameters/values
+		for (SubqueryContainer subqueryContainer : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(container)) {
+    		ProcessorPlan plan = QueryOptimizer.optimizePlan(subqueryContainer.getCommand(), metadata, null, capFinder, analysisRecord, context);
+    		subqueryContainer.getCommand().setProcessorPlan(plan);
+    		
+    		if (c == null) {
+				RuleCollapseSource.replaceCorrelatedReferences(subqueryContainer);
+			}
+		}
+		
+		if (c == null && !container.getGroup().isTempGroupSymbol() && 
+				!CriteriaCapabilityValidatorVisitor.canPushLanguageObject(container, metadata.getModelID(container.getGroup().getMetadataID()), metadata, capFinder, analysisRecord)) {
+			throw new QueryPlannerException(QueryPlugin.Util.getString("RelationalPlanner.nonpushdown_command", container)); //$NON-NLS-1$
+		}
 	}
 
     PlanNode createStoredProcedurePlan(StoredProcedure storedProc) throws QueryMetadataException, TeiidComponentException, TeiidProcessingException {

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -227,7 +227,7 @@
             	return;
             }
             if (! CapabilitiesUtil.supportsScalarFunction(modelID, obj, metadata, capFinder)) {
-                markInvalid(obj, obj.isImplicit()?"":"(implicit) convert" + " Function not supported by source"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+                markInvalid(obj, (obj.isImplicit()?"(implicit) convert":"") + " Function not supported by source"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             }
         } catch(QueryMetadataException e) {
             handleException(new TeiidComponentException(e));

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -39,6 +39,7 @@
 import org.teiid.query.optimizer.relational.RuleStack;
 import org.teiid.query.optimizer.relational.plantree.NodeConstants;
 import org.teiid.query.optimizer.relational.plantree.NodeEditor;
+import org.teiid.query.optimizer.relational.plantree.NodeFactory;
 import org.teiid.query.optimizer.relational.plantree.PlanNode;
 import org.teiid.query.optimizer.relational.plantree.NodeConstants.Info;
 import org.teiid.query.processor.ProcessorPlan;
@@ -352,55 +353,55 @@
 
 	private void replaceCorrelatedReferences(List<SubqueryContainer> containers) {
 		for (SubqueryContainer container : containers) {
-		    RelationalPlan subqueryPlan = (RelationalPlan)container.getCommand().getProcessorPlan();
-		    if (subqueryPlan == null || !(subqueryPlan.getRootNode() instanceof AccessNode)) {
-		    	continue;
-		    }
-		    AccessNode child = (AccessNode)subqueryPlan.getRootNode();
-		    Command command = child.getCommand();
-		    final SymbolMap map = container.getCommand().getCorrelatedReferences();
-		    if (map != null) {
-		    	ExpressionMappingVisitor visitor = new ExpressionMappingVisitor(null) {
-		    		@Override
-		    		public Expression replaceExpression(
-		    				Expression element) {
-		    			if (element instanceof Reference) {
-		    				Reference ref = (Reference)element;
-		    				Expression replacement = map.getMappedExpression(ref.getExpression());
-		    				if (replacement != null) {
-		    					return replacement;
-		    				}
-		    			}
-		    			return element;
-		    		}
-		    	};
-		    	DeepPostOrderNavigator.doVisit(command, visitor);
-		    }
-		    command.setProcessorPlan(container.getCommand().getProcessorPlan());
-		    container.setCommand(command);
+		    replaceCorrelatedReferences(container);
 		}
 	}
 
+	public static void replaceCorrelatedReferences(SubqueryContainer container) {
+		RelationalPlan subqueryPlan = (RelationalPlan)container.getCommand().getProcessorPlan();
+		if (subqueryPlan == null || !(subqueryPlan.getRootNode() instanceof AccessNode)) {
+			return;
+		}
+		AccessNode child = (AccessNode)subqueryPlan.getRootNode();
+		Command command = child.getCommand();
+		final SymbolMap map = container.getCommand().getCorrelatedReferences();
+		if (map != null) {
+			ExpressionMappingVisitor visitor = new ExpressionMappingVisitor(null) {
+				@Override
+				public Expression replaceExpression(
+						Expression element) {
+					if (element instanceof Reference) {
+						Reference ref = (Reference)element;
+						Expression replacement = map.getMappedExpression(ref.getExpression());
+						if (replacement != null) {
+							return replacement;
+						}
+					}
+					return element;
+				}
+			};
+			DeepPostOrderNavigator.doVisit(command, visitor);
+		}
+		command.setProcessorPlan(container.getCommand().getProcessorPlan());
+		container.setCommand(command);
+	}
+
     private void processLimit(PlanNode node,
                               QueryCommand query, QueryMetadataInterface metadata) {
+    	
         Expression limit = (Expression)node.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT);
-        if (limit != null) {
-            if (query.getLimit() != null) {
-                Expression oldlimit = query.getLimit().getRowLimit();
-                query.getLimit().setRowLimit(RulePushLimit.getMinValue(limit, oldlimit)); 
-            } else {
-                query.setLimit(new Limit(null, limit));
-            }
-        }
         Expression offset = (Expression)node.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT);
-        if (offset != null) {
-            if (query.getLimit() != null) {
-                Expression oldoffset = query.getLimit().getOffset();
-                query.getLimit().setOffset(RulePushLimit.getSum(offset, oldoffset, metadata.getFunctionLibrary())); 
-            } else {
-                query.setLimit(new Limit(offset, null));
-            }
+        
+        PlanNode limitNode = NodeFactory.getNewNode(NodeConstants.Types.TUPLE_LIMIT);
+        Expression childLimit = null;
+        Expression childOffset = null;
+        if (query.getLimit() != null) {
+        	childLimit = query.getLimit().getRowLimit();
+        	childOffset = query.getLimit().getOffset();
         }
+        RulePushLimit.combineLimits(limitNode, metadata, limit, offset, childLimit, childOffset);
+        
+        query.setLimit(new Limit((Expression)limitNode.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT), (Expression)limitNode.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT)));
     }
 
     /** 

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushLimit.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushLimit.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushLimit.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -26,11 +26,16 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import org.teiid.api.exception.query.ExpressionEvaluationException;
 import org.teiid.api.exception.query.QueryMetadataException;
 import org.teiid.api.exception.query.QueryPlannerException;
+import org.teiid.common.buffer.BlockedException;
 import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
+import org.teiid.core.TeiidRuntimeException;
 import org.teiid.core.types.DataTypeManager;
 import org.teiid.query.analysis.AnalysisRecord;
+import org.teiid.query.eval.Evaluator;
 import org.teiid.query.function.FunctionLibrary;
 import org.teiid.query.metadata.QueryMetadataInterface;
 import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
@@ -47,7 +52,9 @@
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.Function;
 import org.teiid.query.sql.symbol.SearchedCaseExpression;
+import org.teiid.query.sql.visitor.EvaluatableVisitor;
 import org.teiid.query.util.CommandContext;
+import org.teiid.translator.SourceSystemFunctions;
 
 
 /** 
@@ -116,18 +123,19 @@
             return false;
         }
         
-        switch (child.getType()) {
+        Expression parentLimit = (Expression)limitNode.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT);
+		Expression parentOffset = (Expression)limitNode.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT);
+		switch (child.getType()) {
             case NodeConstants.Types.TUPLE_LIMIT:
             {
+            	
                 //combine the limits
-                Expression minLimit = getMinValue((Expression)limitNode.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT), (Expression)child.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT)); 
-                Expression offSet = getSum((Expression)limitNode.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT), (Expression)child.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT), metadata.getFunctionLibrary()); 
+                Expression childLimit = (Expression)child.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT);
+				Expression childOffset = (Expression)child.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT);
+				
+				combineLimits(limitNode, metadata, parentLimit, parentOffset, childLimit, childOffset);
                 
                 NodeEditor.removeChildNode(limitNode, child);
-                
-                limitNode.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, minLimit);
-                limitNode.setProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT, offSet);
-                
                 limitNodes.remove(child);
                 
                 return canPushLimit(rootNode, limitNode, limitNodes, metadata, capFinder);
@@ -141,9 +149,7 @@
                 List<PlanNode> grandChildren = new LinkedList<PlanNode>(child.getChildren());
                 for (PlanNode grandChild : grandChildren) {
                     PlanNode newLimit = NodeFactory.getNewNode(NodeConstants.Types.TUPLE_LIMIT);
-                    Expression limit = (Expression)limitNode.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT);
-                    Expression offset = (Expression)limitNode.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT);
-                    newLimit.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, getSum(limit, offset, metadata.getFunctionLibrary()));
+                    newLimit.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, op(SourceSystemFunctions.ADD_OP, parentLimit, parentOffset, metadata.getFunctionLibrary()));
                     grandChild.addAsParent(newLimit);
                     limitNodes.add(newLimit);
                 }
@@ -171,6 +177,28 @@
             }
         }
     }
+
+	static void combineLimits(PlanNode limitNode,
+			QueryMetadataInterface metadata, Expression parentLimit,
+			Expression parentOffset, Expression childLimit,
+			Expression childOffset) {
+		Expression minLimit = null;
+		Expression offSet = null;
+		
+		if (childLimit == null) {
+			minLimit = parentLimit;
+			offSet = op(SourceSystemFunctions.ADD_OP, childOffset, parentOffset, metadata.getFunctionLibrary());
+		} else {
+			minLimit = getMinValue(parentLimit, op(SourceSystemFunctions.SUBTRACT_OP, childLimit, parentOffset, metadata.getFunctionLibrary())); 
+		    offSet = childOffset;
+		    if (offSet == null) {
+		    	offSet = parentOffset;
+		    }
+		}
+		
+		limitNode.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, minLimit);
+		limitNode.setProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT, offSet);
+	}
     
     static PlanNode raiseAccessOverLimit(PlanNode rootNode,
                                           PlanNode accessNode,
@@ -206,7 +234,7 @@
                 
                 // since we're pushing underneath the offset, we want enough rows to satisfy both the limit and the row offset
                 
-                pushedLimit.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, getSum(limit, offset, metadata.getFunctionLibrary())); 
+                pushedLimit.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, op(SourceSystemFunctions.ADD_OP, limit, offset, metadata.getFunctionLibrary())); 
                 
                 if (accessNode.getChildCount() == 0) {
                     accessNode.addFirstChild(pushedLimit);
@@ -221,11 +249,7 @@
         return RuleRaiseAccess.performRaise(rootNode, accessNode, parentNode);
     }
 
-    /**
-     * @param limitNode
-     * @param child
-     */
-    static Expression getSum(Expression expr1, Expression expr2, FunctionLibrary functionLibrary) {
+    static Expression op(String op, Expression expr1, Expression expr2, FunctionLibrary functionLibrary) {
         if (expr1 == null) {
             return expr2;
         }
@@ -233,15 +257,29 @@
             return expr1;
         }
         
-        Function newExpr = new Function("+", new Expression[] {expr1, expr2}); //$NON-NLS-1$
-        newExpr.setFunctionDescriptor(functionLibrary.findFunction("+", new Class[] {DataTypeManager.DefaultDataClasses.INTEGER, DataTypeManager.DefaultDataClasses.INTEGER})); //$NON-NLS-1$
+        Function newExpr = new Function(op, new Expression[] {expr1, expr2});
+        newExpr.setFunctionDescriptor(functionLibrary.findFunction(op, new Class[] {DataTypeManager.DefaultDataClasses.INTEGER, DataTypeManager.DefaultDataClasses.INTEGER}));
         newExpr.setType(newExpr.getFunctionDescriptor().getReturnType());
+        return evaluateIfPossible(newExpr);
+    }
+
+	private static Expression evaluateIfPossible(Expression newExpr) {
+		if (EvaluatableVisitor.isFullyEvaluatable(newExpr, true)) {
+        	try {
+				return new Constant(Evaluator.evaluate(newExpr), newExpr.getType());
+			} catch (TeiidException e) {
+				throw new TeiidRuntimeException(e, "Unexpected Exception"); //$NON-NLS-1$
+			}
+        }
         return newExpr;
-    }
+	}
     
     /**
      * @param limitNode
      * @param child
+     * @throws TeiidComponentException 
+     * @throws BlockedException 
+     * @throws ExpressionEvaluationException 
      */
     static Expression getMinValue(Expression expr1, Expression expr2) {
         if (expr1 == null) {
@@ -254,7 +292,8 @@
         Criteria crit = new CompareCriteria(expr1, CompareCriteria.LT, expr2);
         SearchedCaseExpression sce = new SearchedCaseExpression(Arrays.asList(new Object[] {crit}), Arrays.asList(new Object[] {expr1}));
         sce.setElseExpression(expr2);
-        return sce;
+        sce.setType(expr1.getType());
+        return evaluateIfPossible(sce);
     }
     
     /**

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -50,6 +50,7 @@
 import org.teiid.query.function.FunctionDescriptor;
 import org.teiid.query.sql.lang.XMLTable;
 import org.teiid.query.sql.lang.XMLTable.XMLColumn;
+import org.teiid.query.xquery.saxon.SaxonXQueryExpression.Result;
 
 /**
  * Handles xml table processing.
@@ -69,7 +70,7 @@
 	private XMLTable table;
 	private List<XMLColumn> projectedColumns;
 	
-	private SequenceIterator result;
+	private Result result;
 	private int rowCount = 0;
 	private Item item;
 	
@@ -130,7 +131,7 @@
 			TeiidComponentException, TeiidProcessingException {
 		if (item == null) {
 			try {
-				item = result.next();
+				item = result.iter.next();
 			} catch (XPathException e) {
 				throw new TeiidProcessingException(e, QueryPlugin.Util.getString("XMLTableNode.error", e.getMessage())); //$NON-NLS-1$
 			}

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -58,8 +58,10 @@
 import org.teiid.query.sql.lang.GroupContext;
 import org.teiid.query.sql.lang.ProcedureContainer;
 import org.teiid.query.sql.lang.Query;
+import org.teiid.query.sql.lang.SubqueryContainer;
 import org.teiid.query.sql.lang.UnaryFromClause;
 import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
 
 
 /**
@@ -295,5 +297,15 @@
         
         return Collections.EMPTY_MAP;
     }
+    
+	public static void resolveSubqueries(Command command,
+			TempMetadataAdapter metadata, AnalysisRecord analysis)
+			throws QueryResolverException, TeiidComponentException {
+		for (SubqueryContainer container : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(command)) {
+            QueryResolver.setChildMetadata(container.getCommand(), command);
+            
+            QueryResolver.resolveCommand(container.getCommand(), Collections.EMPTY_MAP, metadata.getMetadata(), analysis);
+        }
+	}
 
 }

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/DeleteResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/DeleteResolver.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/DeleteResolver.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -33,6 +33,7 @@
 import org.teiid.query.metadata.TempMetadataAdapter;
 import org.teiid.query.metadata.TempMetadataStore;
 import org.teiid.query.resolver.ProcedureContainerResolver;
+import org.teiid.query.resolver.QueryResolver;
 import org.teiid.query.resolver.util.ResolverVisitor;
 import org.teiid.query.sql.lang.Command;
 import org.teiid.query.sql.lang.Delete;
@@ -58,7 +59,7 @@
         Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
         groups.add(delete.getGroup());
         ResolverVisitor.resolveLanguageObject(delete, groups, delete.getExternalGroupContexts(), metadata);
-
+        QueryResolver.resolveSubqueries(command, metadata, analysis);
     }
     
     /** 

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -71,13 +71,14 @@
     public void resolveProceduralCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis) 
         throws QueryMetadataException, QueryResolverException, TeiidComponentException {
 
-
         // Cast to known type
         Insert insert = (Insert) command;
         
-        //variables and values must be resolved separately to account for implicitly defined temp groups
-        resolveList(insert.getValues(), metadata, insert.getExternalGroupContexts(), null);
-        
+        if (insert.getValues() != null) {
+        	QueryResolver.resolveSubqueries(command, metadata, analysis);
+	        //variables and values must be resolved separately to account for implicitly defined temp groups
+	        resolveList(insert.getValues(), metadata, insert.getExternalGroupContexts(), null);
+    	}
         //resolve subquery if there
         if(insert.getQueryExpression() != null) {
         	QueryResolver.setChildMetadata(insert.getQueryExpression(), command);

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateResolver.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateResolver.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -39,6 +39,7 @@
 import org.teiid.query.metadata.QueryMetadataInterface;
 import org.teiid.query.metadata.TempMetadataAdapter;
 import org.teiid.query.resolver.ProcedureContainerResolver;
+import org.teiid.query.resolver.QueryResolver;
 import org.teiid.query.resolver.VariableResolver;
 import org.teiid.query.resolver.util.ResolverUtil;
 import org.teiid.query.resolver.util.ResolverVisitor;
@@ -69,6 +70,7 @@
         Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
         groups.add(update.getGroup());
         ResolverVisitor.resolveLanguageObject(update, groups, update.getExternalGroupContexts(), metadata);
+        QueryResolver.resolveSubqueries(command, metadata, analysis);
     }
     
     /** 

Modified: trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -2329,9 +2329,12 @@
         //After this method, no longer need to display named parameters
         storedProcedure.setDisplayNamedParameters(false);
         
-        for (Iterator i = storedProcedure.getInputParameters().iterator(); i.hasNext();) {
-            SPParameter param = (SPParameter)i.next();
-            param.setExpression(rewriteExpressionDirect(param.getExpression()));
+        for (SPParameter param : storedProcedure.getInputParameters()) {
+            if (!processing) {
+            	param.setExpression(rewriteExpressionDirect(param.getExpression()));
+            } else if (!(param.getExpression() instanceof Constant)) {
+            	param.setExpression(new Constant(this.evaluator.evaluate(param.getExpression(), null), param.getClassType()));
+            }
         }
         return storedProcedure;
     }

Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -34,6 +34,7 @@
 import org.teiid.query.sql.LanguageVisitor;
 import org.teiid.query.sql.lang.DependentSetCriteria;
 import org.teiid.query.sql.lang.ExistsCriteria;
+import org.teiid.query.sql.lang.SPParameter;
 import org.teiid.query.sql.lang.StoredProcedure;
 import org.teiid.query.sql.lang.SubqueryCompareCriteria;
 import org.teiid.query.sql.lang.SubquerySetCriteria;
@@ -127,6 +128,11 @@
     
     public void visit(StoredProcedure proc){
 		evaluationNotPossible(EvaluationLevel.PUSH_DOWN);
+		for (SPParameter param : proc.getInputParameters()) {
+			if (!(param.getExpression() instanceof Constant)) {
+				evaluationNotPossible(EvaluationLevel.PROCESSING);
+			}
+		}
     }
     
     public void visit(ScalarSubquery obj){

Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -945,7 +945,8 @@
         append("("); //$NON-NLS-1$
         boolean first = true;
         for (SPParameter param : obj.getParameters()) {
-        	if (param.getParameterType() == SPParameter.RETURN_VALUE || param.getParameterType() == SPParameter.RESULT_SET || param.getExpression() == null) {
+        	if (param.isUsingDefault() || param.getParameterType() == SPParameter.RETURN_VALUE 
+        			|| param.getParameterType() == SPParameter.RESULT_SET || param.getExpression() == null) {
         		continue;
         	}
         	if (first) {

Modified: trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -39,6 +39,7 @@
 import org.teiid.api.exception.query.QueryMetadataException;
 import org.teiid.api.exception.query.QueryValidatorException;
 import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
 import org.teiid.core.TeiidProcessingException;
 import org.teiid.core.types.DataTypeManager;
 import org.teiid.core.util.EquivalenceUtil;
@@ -195,9 +196,27 @@
 	public void visit(Delete obj) {
     	validateNoXMLUpdates(obj);
         validateHasProjectedSymbols(obj);
-        validateGroupSupportsUpdate(obj.getGroup());
+        GroupSymbol group = obj.getGroup();
+        validateGroupSupportsUpdate(group);
+        Criteria crit = obj.getCriteria();
+        validateVirtualUpdate(group, crit);
     }
 
+	private void validateVirtualUpdate(GroupSymbol group,
+			Criteria crit) {
+		if (crit == null) {
+			return;
+		}
+		try {
+			if (getMetadata().isVirtualGroup(group.getMetadataID()) && 
+					!ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(crit).isEmpty()) {
+				handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.virtual_update_subquery"), crit); //$NON-NLS-1$
+			}
+		} catch (TeiidException e) {
+			handleException(e);
+		}
+	}
+
     public void visit(GroupBy obj) {
     	// Get list of all group by IDs
         List groupBySymbols = obj.getSymbols();
@@ -307,6 +326,7 @@
         validateHasProjectedSymbols(obj);
         validateGroupSupportsUpdate(obj.getGroup());
         validateUpdate(obj);
+        validateVirtualUpdate(obj.getGroup(), obj.getCriteria());
     }
 
     public void visit(Into obj) {
@@ -865,7 +885,7 @@
     
     protected void validateSetClauseList(SetClauseList list) {
     	Set<ElementSymbol> dups = new HashSet<ElementSymbol>();
-	    HashSet changeVars = new HashSet();
+	    HashSet<ElementSymbol> changeVars = new HashSet<ElementSymbol>();
 	    for (SetClause clause : list.getClauses()) {
 	    	ElementSymbol elementID = clause.getSymbol();
 	        if (!changeVars.add(elementID)) {

Modified: trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -28,6 +28,7 @@
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -88,10 +89,27 @@
 import org.teiid.query.sql.symbol.DerivedColumn;
 import org.teiid.query.sql.symbol.XMLNamespaces;
 import org.teiid.query.sql.symbol.XMLNamespaces.NamespaceItem;
+import org.teiid.translator.WSConnection.Util;
 
 @SuppressWarnings("serial")
 public class SaxonXQueryExpression {
 	
+	public static class Result {
+		public SequenceIterator iter;
+		public List<Source> sources = new LinkedList<Source>();
+		
+		public void close() {
+			for (Source source : sources) {
+				Util.closeSource(source);
+			}
+			if (iter != null) {
+				iter.close();
+			}
+			sources.clear();
+			iter = null;
+		}
+	}
+	
 	private static final Expression DUMMY_EXPRESSION = new Expression() {
 		@Override
 		public ItemType getItemType(TypeHierarchy th) {
@@ -133,7 +151,7 @@
 	private net.sf.saxon.query.XQueryExpression xQuery;    
 	private Configuration config = new Configuration();
 	private PathMapRoot contextRoot;
-	
+
     public SaxonXQueryExpression(String xQueryString, XMLNamespaces namespaces, List<DerivedColumn> passing, List<XMLTable.XMLColumn> columns) 
     throws QueryResolverException {
         config.setErrorListener(ERROR_LISTENER);
@@ -261,7 +279,7 @@
 				if (root.getRootExpression() instanceof ContextItemExpression || root.getRootExpression() instanceof RootExpression) {
 					if (subContextRoot != null) {
 						if (record.recordDebug()) {
-							record.println("Document projection will not be used, since multiple context item exist in column path " + xmlColumn.getPath()); //$NON-NLS-1$
+							record.println("Document projection will not be used, since multiple context items exist in column path " + xmlColumn.getPath()); //$NON-NLS-1$
 						}
 						return null;
 					}
@@ -280,8 +298,7 @@
 			}
 	    	HashSet<PathMapNode> subFinalNodes = new HashSet<PathMapNode>();
 			getReturnableNodes(subContextRoot, subFinalNodes);
-	    	for (Iterator iter = subFinalNodes.iterator(); iter.hasNext(); ) {
-	            PathMapNode subNode = (PathMapNode)iter.next();
+	    	for (PathMapNode subNode : subFinalNodes) {
 		    	addReturnedArcs(xmlColumn, subNode);
 	        }
 		}
@@ -354,47 +371,55 @@
 	    	xmlColumn.setPathExpression(exp);
 		}
 	}
-    
-    public SequenceIterator evaluateXQuery(Object context, Map<String, Object> parameterValues) throws TeiidProcessingException {
+	
+    public Result evaluateXQuery(Object context, Map<String, Object> parameterValues) throws TeiidProcessingException {
         DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
-        
+
+        Result result = new Result();
         try {
-	        for (Map.Entry<String, Object> entry : parameterValues.entrySet()) {
-	            Object value = entry.getValue();
-	            if(value instanceof SQLXML) {                    
-	            	value = XMLSystemFunctions.convertToSource(value);
-	            } else if (value instanceof java.util.Date) {
-	            	java.util.Date d = (java.util.Date)value;
-	            	value = XMLSystemFunctions.convertToAtomicValue(value);
+	        try {
+		        for (Map.Entry<String, Object> entry : parameterValues.entrySet()) {
+		            Object value = entry.getValue();
+		            if(value instanceof SQLXML) {                    
+		            	value = XMLSystemFunctions.convertToSource(value);
+		            	result.sources.add((Source)value);
+		            } else if (value instanceof java.util.Date) {
+		            	value = XMLSystemFunctions.convertToAtomicValue(value);
+		            }
+		            dynamicContext.setParameter(entry.getKey(), value);                
+		        }
+	        } catch (TransformerException e) {
+	        	throw new TeiidProcessingException(e);
+	        }
+	        if (context != null) {
+	        	Source source = XMLSystemFunctions.convertToSource(context);
+	        	result.sources.add(source);
+	            if (contextRoot != null) {
+	            	//create our own filter as this logic is not provided in the free saxon
+	                ProxyReceiver filter = new PathMapFilter(contextRoot);
+	                AugmentedSource sourceInput = AugmentedSource.makeAugmentedSource(source);
+	                sourceInput.addFilter(filter);
+	                source = sourceInput;
 	            }
-	            dynamicContext.setParameter(entry.getKey(), value);                
+	            DocumentInfo doc;
+				try {
+					doc = config.buildDocument(source);
+				} catch (XPathException e) {
+					throw new TeiidProcessingException(e, QueryPlugin.Util.getString("SaxonXQueryExpression.bad_context")); //$NON-NLS-1$
+				}
+		        dynamicContext.setContextItem(doc);
 	        }
-        } catch (TransformerException e) {
-        	throw new TeiidProcessingException(e);
+	        try {
+	        	result.iter = xQuery.iterator(dynamicContext);
+	        	return result;
+	        } catch (TransformerException e) {
+	        	throw new TeiidProcessingException(e, QueryPlugin.Util.getString("SaxonXQueryExpression.bad_xquery")); //$NON-NLS-1$
+	        }       
+        } finally {
+        	if (result.iter == null) {
+        		result.close();
+        	}
         }
-        
-        if (context != null) {
-        	Source source = XMLSystemFunctions.convertToSource(context);
-            if (contextRoot != null) {
-            	//create our own filter as this logic is not provided in the free saxon
-                ProxyReceiver filter = new PathMapFilter(contextRoot);
-                AugmentedSource sourceInput = AugmentedSource.makeAugmentedSource(source);
-                sourceInput.addFilter(filter);
-                source = sourceInput;
-            }
-            DocumentInfo doc;
-			try {
-				doc = config.buildDocument(source);
-			} catch (XPathException e) {
-				throw new TeiidProcessingException(e, QueryPlugin.Util.getString("SaxonXQueryExpression.bad_context")); //$NON-NLS-1$
-			}
-	        dynamicContext.setContextItem(doc);
-        }
-        try {
-        	return xQuery.iterator(dynamicContext);
-        } catch (TransformerException e) {
-        	throw new TeiidProcessingException(e, QueryPlugin.Util.getString("SaxonXQueryExpression.bad_xquery")); //$NON-NLS-1$
-        }       
     }
     
 	public XMLType createXMLType(final SequenceIterator iter, BufferManager bufferManager, boolean emptyOnEmpty) throws XPathException, TeiidComponentException, TeiidProcessingException {

Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties	2010-10-26 14:11:06 UTC (rev 2682)
@@ -193,6 +193,7 @@
 ValidationVisitor.translated_or=Translated user criteria must not contain OR criteria
 ValidationVisitor.union_insert = Select into is not allowed under a set operation: {0}.
 ValidationVisitor.multisource_insert = A multi-source table, {0}, cannot be used in an INSERT with query expression or SELECT INTO statement.
+ValidationVisitor.virtual_update_subquery = Subqueries are not allowed in the criteria for a virtual UPDATE/DELETE: {0}
 ERR.015.012.0029 = INSERT, UPDATE, and DELETE not allowed on XML documents
 ERR.015.012.0030 = Commands used in stored procedure language not allowed on XML documents
 ERR.015.012.0031 = Queries against XML documents can not have a GROUP By clause
@@ -874,7 +875,9 @@
 translator_not_found=Translator {0} not accessible.
 datasource_not_found=Data Source {0} not accessible.
 
-RequestWorkItem.cache_nondeterministic=Caching command '{0}'' at a session level, but less deterministic functions were evaluated. 
+RequestWorkItem.cache_nondeterministic=Caching command "{0}" at a session level, but less deterministic functions were evaluated. 
 not_found_cache=Results not found in cache
 failed_to_unwrap_connection=Failed to unwrap the source connection.
-connection_factory_not_found=Failed to the Connection Factory with JNDI name {0}. Please check the name for spelling or deploy the Connection Factory with specified name. 
\ No newline at end of file
+connection_factory_not_found=Failed to the Connection Factory with JNDI name {0}. Please check the name for spelling or deploy the Connection Factory with specified name. 
+
+RelationalPlanner.nonpushdown_command=Source command "{0}" contains non-pushdown constructs. 
\ No newline at end of file

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	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -381,7 +381,7 @@
 		List<String> values = Arrays.asList("aa "); //$NON-NLS-1$
         FakeDataManager dataManager = new FakeDataManager();
         TestProcessor.sampleData2b(dataManager);
-		helpTestProcessing(preparedSql, values, expected, dataManager, FakeMetadataFactory.example1Cached(), false, false, FakeMetadataFactory.example1VDB());
+		helpTestProcessing(preparedSql, values, expected, dataManager, TestOptimizer.getGenericFinder(), FakeMetadataFactory.example1Cached(), null, false, false, false, FakeMetadataFactory.example1VDB());
     }
     
     @Test(expected=QueryValidatorException.class) public void testLimitValidation() throws Exception {

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -29,6 +29,7 @@
 import java.util.List;
 
 import org.junit.Test;
+import org.teiid.query.optimizer.TestOptimizer;
 import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
 import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
 import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
@@ -59,7 +60,7 @@
 		dataManager.addData("UPDATE pm1.g1 SET e1 = ?, e3 = ? WHERE pm1.g1.e2 = ?", new List[] {Arrays.asList(4)}); //$NON-NLS-1$
 		// Source capabilities must support batched updates
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
-        BasicSourceCapabilities caps = new BasicSourceCapabilities();
+        BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.BULK_UPDATE, true);
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
         
@@ -122,7 +123,7 @@
 		
 		// Source capabilities must support batched updates
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
-        BasicSourceCapabilities caps = new BasicSourceCapabilities();
+        BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
         
@@ -218,7 +219,7 @@
 		
 		// Source capabilities must support batched updates
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
-        BasicSourceCapabilities caps = new BasicSourceCapabilities();
+        BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
         
@@ -311,7 +312,7 @@
 		
 		// Source capabilities must support batched updates
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
-        BasicSourceCapabilities caps = new BasicSourceCapabilities();
+        BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
         
@@ -434,7 +435,7 @@
 		
 		// Source capabilities must support batched updates
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
-        BasicSourceCapabilities caps = new BasicSourceCapabilities();
+        BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
         

Modified: trunk/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -35,11 +35,11 @@
 import org.teiid.dqp.internal.datamgr.ConnectorWorkItem;
 import org.teiid.dqp.message.AtomicRequestMessage;
 import org.teiid.dqp.message.AtomicResultsMessage;
-import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
+import org.teiid.query.optimizer.TestOptimizer;
 import org.teiid.query.optimizer.capabilities.SourceCapabilities;
 import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.translator.DataNotAvailableException;
 import org.teiid.translator.TranslatorException;
-import org.teiid.translator.DataNotAvailableException;
 
 
 /**
@@ -56,7 +56,7 @@
     
     public AutoGenDataService() {
     	super("FakeConnector","FakeConnector"); //$NON-NLS-1$ //$NON-NLS-2$
-        caps = new BasicSourceCapabilities();
+        caps = TestOptimizer.getTypicalCapabilities();
     }
 
     public void setRows(int rows) {

Modified: trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -31,7 +31,9 @@
 import java.util.Map;
 import java.util.Properties;
 
+import org.jboss.virtual.VirtualFile;
 import org.junit.Test;
+import org.mockito.Mockito;
 import org.teiid.adminapi.Model;
 import org.teiid.adminapi.impl.ModelMetaData;
 import org.teiid.adminapi.impl.VDBMetaData;
@@ -42,6 +44,7 @@
 import org.teiid.metadata.Table;
 import org.teiid.query.metadata.CompositeMetadataStore;
 import org.teiid.query.metadata.TransformationMetadata;
+import org.teiid.query.metadata.TransformationMetadata.Resource;
 import org.teiid.query.unittest.FakeMetadataFactory;
 import org.teiid.translator.TranslatorException;
 
@@ -71,6 +74,14 @@
 		
 		MetadataFactory mf1 = new MetadataFactory("x1", datatypes, new Properties()); //$NON-NLS-1$
 		mf1.addProcedure("y"); //$NON-NLS-1$
+		
+		Table table = mf1.addTable("doc");
+		table.setSchemaPaths(Arrays.asList("../../x.xsd"));
+		table.setResourcePath("/a/b/doc.xmi");
+		
+		HashMap<String, Resource> resources = new HashMap<String, Resource>();
+		resources.put("/x.xsd", new Resource(Mockito.mock(VirtualFile.class), true));
+		
 		CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.getMetadataStore(), mf1.getMetadataStore()));
 		
 		VDBMetaData vdb = new VDBMetaData();
@@ -79,8 +90,9 @@
 		
 		vdb.addModel(buildModel("x"));
 		vdb.addModel(buildModel("x1"));
+		vdb.addModel(buildModel("y"));
 		
-		return new TransformationMetadata(vdb, cms, null, null, FakeMetadataFactory.SFM.getSystemFunctions());
+		return new TransformationMetadata(vdb, cms, resources, null, FakeMetadataFactory.SFM.getSystemFunctions());
 	}
 	
 	ModelMetaData buildModel(String name) {
@@ -131,4 +143,9 @@
 		tm.getElementID("x.FoO.coL");
 	}
 	
+	@Test public void testRelativeSchemas() throws Exception {
+		TransformationMetadata tm = exampleTransformationMetadata();
+		assertEquals(1, tm.getXMLSchemas(tm.getGroupID("x1.doc")).size());
+	}
+	
 }

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -268,7 +268,7 @@
 
         String sql = "SELECT * FROM pm1.g1 limit 50, 100";//$NON-NLS-1$
         String[] expectedSql = new String[] {
-            "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 LIMIT (100 + 50)" //$NON-NLS-1$
+            "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 LIMIT 150" //$NON-NLS-1$
             };
         ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), 
                                                     null, capFinder, expectedSql, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);  
@@ -535,7 +535,7 @@
 
         String sql = "SELECT * FROM pm1.g1 UNION SELECT * FROM PM1.g2 LIMIT 50, 100";//$NON-NLS-1$
         String[] expectedSql = new String[] {
-            "SELECT PM1.g2.e1 AS c_0, PM1.g2.e2 AS c_1, PM1.g2.e3 AS c_2, PM1.g2.e4 AS c_3 FROM PM1.g2 LIMIT (100 + 50)", "SELECT pm1.g1.e1 AS c_0, pm1.g1.e2 AS c_1, pm1.g1.e3 AS c_2, pm1.g1.e4 AS c_3 FROM pm1.g1 LIMIT (100 + 50)" //$NON-NLS-1$ //$NON-NLS-2$
+            "SELECT PM1.g2.e1 AS c_0, PM1.g2.e2 AS c_1, PM1.g2.e3 AS c_2, PM1.g2.e4 AS c_3 FROM PM1.g2 LIMIT 150", "SELECT pm1.g1.e1 AS c_0, pm1.g1.e2 AS c_1, pm1.g1.e3 AS c_2, pm1.g1.e4 AS c_3 FROM pm1.g1 LIMIT 150" //$NON-NLS-1$ //$NON-NLS-2$
             };
         ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), 
                                                     null, capFinder, expectedSql, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);  
@@ -603,7 +603,7 @@
 
         String sql = "SELECT * from (SELECT pm1.g1.e1 FROM pm1.g1 LIMIT 10, 100) x LIMIT 20, 75";//$NON-NLS-1$
         String[] expectedSql = new String[] {
-            "SELECT pm1.g1.e1 AS c_0 FROM pm1.g1 LIMIT CASE WHEN (75 + (20 + 10)) < (100 + 10) THEN (75 + (20 + 10)) ELSE (100 + 10) END" //$NON-NLS-1$
+            "SELECT pm1.g1.e1 AS c_0 FROM pm1.g1 LIMIT 105" //$NON-NLS-1$
             };
         ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), 
                                                     null, capFinder, expectedSql, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);  
@@ -636,9 +636,9 @@
         // pm1 model supports order by
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
 
-        String sql = "SELECT * from (SELECT pm1.g1.e1 FROM pm1.g1 LIMIT 10, 100) x LIMIT 20, 75";//$NON-NLS-1$
+        String sql = "SELECT * from (SELECT pm1.g1.e1 FROM pm1.g1 LIMIT 10, 100) x LIMIT 40, 75";//$NON-NLS-1$
         String[] expectedSql = new String[] {
-            "SELECT pm1.g1.e1 AS c_0 FROM pm1.g1 LIMIT (20 + 10), CASE WHEN 75 < 100 THEN 75 ELSE 100 END" //$NON-NLS-1$
+            "SELECT pm1.g1.e1 AS c_0 FROM pm1.g1 LIMIT 10, 60" //$NON-NLS-1$
             };
         ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), 
                                                     null, capFinder, expectedSql, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);  

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -792,14 +792,20 @@
 			new String[] { "UPDATE pm1.g1 SET pm1.g1.e1 = 'MyString', pm1.g1.e2 = 1 WHERE pm1.g1.e3 = TRUE"} ); //$NON-NLS-1$
   	}
   	
-    @Test public void testUpdate2() { 
+    @Test public void testUpdate2() throws Exception { 
+    	BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities();
+    	bsc.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
+    	DefaultCapabilitiesFinder dcf = new DefaultCapabilitiesFinder(bsc);
         helpPlan("Update pm1.g1 Set pm1.g1.e1= LTRIM('MyString'), pm1.g1.e2= 1 where pm1.g1.e2= convert(pm1.g1.e4, integer)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
-			new String[] { "UPDATE pm1.g1 SET pm1.g1.e1 = 'MyString', pm1.g1.e2 = 1 WHERE pm1.g1.e2 = convert(pm1.g1.e4, integer)"} ); //$NON-NLS-1$
+			new String[] { "UPDATE pm1.g1 SET e1 = 'MyString', e2 = 1 WHERE pm1.g1.e2 = convert(pm1.g1.e4, integer)"}, dcf, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
     }
     
-    @Test public void testDelete() { 
+    @Test public void testDelete() throws Exception { 
+    	BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities();
+    	bsc.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
+    	DefaultCapabilitiesFinder dcf = new DefaultCapabilitiesFinder(bsc);
     	helpPlan("Delete from pm1.g1 where pm1.g1.e1 = cast(pm1.g1.e2 AS string)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
-			new String[] { "DELETE FROM pm1.g1 WHERE pm1.g1.e1 = cast(pm1.g1.e2 AS string)"} ); //$NON-NLS-1$
+			new String[] { "DELETE FROM pm1.g1 WHERE pm1.g1.e1 = convert(pm1.g1.e2, string)"}, dcf, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
   	}
 
 	// ############################# TESTS ON EXAMPLE 1 ############################
@@ -4605,11 +4611,10 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);
     }
     
-    @Test public void testUpdateWithElement() {
+    @Test public void testUpdateWithElement() throws Exception {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
-        caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
-        caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, true);        
+        caps.setFunctionSupport(SourceSystemFunctions.ADD_OP, true);        
         capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
 
         String sql = "UPDATE BQT1.SmallA SET IntKey = IntKey + 1"; //$NON-NLS-1$
@@ -4618,7 +4623,7 @@
                                       FakeMetadataFactory.exampleBQTCached(),
                                       null, capFinder,
                                       new String[] {"UPDATE BQT1.SmallA SET IntKey = (IntKey + 1)"}, //$NON-NLS-1$ 
-                                      SHOULD_SUCCEED );
+                                      ComparisonMode.EXACT_COMMAND_STRING );
 
         checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
     }            
@@ -6729,6 +6734,11 @@
             new String[] { "SELECT g_0.e1 FROM pm2.g2 AS g_0 WHERE g_0.e1 = pm2.g1.e1", "SELECT g_0.e1 FROM pm2.g1 AS g_0 WHERE g_0.e2 IN (1, 2)" }, capFinder, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
         checkNodeTypes(plan, new int[] {1}, new Class[] {NestedTableJoinStrategy.class});         
     }
+    
+    @Test public void testUpdatePushdownFails() { 
+        helpPlan("update pm1.g1 set e1 = 1 where exists (select 1 from pm1.g2)", FakeMetadataFactory.example1Cached(), null, //$NON-NLS-1$
+			null, null, false); //$NON-NLS-1$
+    }
 
 	public static final boolean DEBUG = false;
 

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -22,6 +22,7 @@
 import org.teiid.query.unittest.FakeMetadataFactory;
 import org.teiid.query.unittest.FakeMetadataObject;
 import org.teiid.query.unittest.FakeMetadataStore;
+import org.teiid.translator.SourceSystemFunctions;
 
 
 public class TestInsertProcessing {
@@ -33,6 +34,7 @@
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder(); 
         BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities(); 
         caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true); 
+        caps.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$ 
 
         List pm1g1e = FakeMetadataFactory.createElements(pm1g1, 
@@ -155,8 +157,8 @@
         
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder(); 
         BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities(); 
- 
-        caps.setCapabilitySupport(Capability.BULK_UPDATE, true); 
+        caps.setCapabilitySupport(Capability.BULK_UPDATE, true);
+        caps.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$ 
 
         List pm1g1e = FakeMetadataFactory.createElements(pm1g1, 
@@ -195,10 +197,9 @@
         
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder(); 
         BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities(); 
- 
         caps.setCapabilitySupport(Capability.BULK_UPDATE, false); 
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$ 
-
+        caps.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
         List pm1g1e = FakeMetadataFactory.createElements(pm1g1, 
                                     new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$ 
                                     new String[] { DataTypeManager.DefaultDataTypes.BIG_INTEGER, DataTypeManager.DefaultDataTypes.FLOAT});

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -83,7 +83,6 @@
 import org.teiid.query.processor.relational.RelationalNode;
 import org.teiid.query.processor.relational.RelationalPlan;
 import org.teiid.query.resolver.QueryResolver;
-import org.teiid.query.resolver.util.BindVariableVisitor;
 import org.teiid.query.rewriter.QueryRewriter;
 import org.teiid.query.sql.lang.Command;
 import org.teiid.query.sql.lang.SPParameter;
@@ -116,26 +115,17 @@
         }
     }
 
-	public static ProcessorPlan helpGetPlan(String sql, QueryMetadataInterface metadata) { 
-        return helpGetPlan(sql, metadata, null);
+	public static ProcessorPlan helpGetPlan(String sql, QueryMetadataInterface metadata) {
+		return helpGetPlan(sql, metadata, new DefaultCapabilitiesFinder());
     }
-    
-    public static ProcessorPlan helpGetPlan(String sql, QueryMetadataInterface metadata, String[] bindings) { 
-        if(DEBUG) System.out.println("\n####################################\n" + sql);  //$NON-NLS-1$
+	
+	public static ProcessorPlan helpGetPlan(String sql, QueryMetadataInterface metadata, CapabilitiesFinder finder) { 
+		if(DEBUG) System.out.println("\n####################################\n" + sql);  //$NON-NLS-1$
 
         Command command = helpParse(sql);   
         
-        // attach bindings
-        if(bindings != null) { 
-            try { 
-                BindVariableVisitor.bindReferences(command, Arrays.asList(bindings), metadata);
-            } catch(Throwable e) {
-                throw new TeiidRuntimeException(e);
-            }
-        }
+    	ProcessorPlan process = helpGetPlan(command, metadata, finder);
         
-    	ProcessorPlan process = helpGetPlan(command, metadata);
-        
         return process;
     }
 
@@ -6232,11 +6222,11 @@
         String sql = "update vm1.g39 set e2=3"; //$NON-NLS-1$ 
  
         // Plan query 
-        ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());        
+        ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());        
 
         // Construct data manager with data 
         HardcodedDataManager dataManager = new HardcodedDataManager(); 
-        dataManager.addData("SELECT pm1.g1.e2 FROM pm1.g1", //$NON-NLS-1$ 
+        dataManager.addData("SELECT g_0.e2 FROM pm1.g1 AS g_0 WHERE g_0.e2 = 3", //$NON-NLS-1$ 
                             new List[] { Arrays.asList(new Object[] { new Integer(3) } )});
         dataManager.addData("UPDATE pm1.g1 SET e2 = 3 WHERE pm1.g1.e2 = 3", //$NON-NLS-1$ 
                             new List[] { Arrays.asList(new Object[] { new Integer(1) } )});
@@ -7331,7 +7321,7 @@
         FakeDataManager dataManager = new FakeDataManager();
         sampleData2(dataManager);
         
-        ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder, new String[] {"SELECT pm1.g1.e1 FROM pm1.g1 LIMIT (5 + 1)"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+        ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder, new String[] {"SELECT pm1.g1.e1 FROM pm1.g1 LIMIT 6"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
         helpProcess(plan, dataManager, expected);          
     }
     
@@ -7574,6 +7564,21 @@
 
         helpProcess(plan, hdm, expected);
     }
-       
+    
+    @Test public void testStoredProcedureSubqueryInput() {
+    	String sql = "exec pm1.sp2((select e2 from pm1.g1 order by e1 limit 1))"; //$NON-NLS-1$
+    	
+        List[] expected = new List[] {
+        		Arrays.asList("b", 2),
+        };    
+    
+        HardcodedDataManager dataManager = new HardcodedDataManager();
+        dataManager.addData("SELECT pm1.g1.e2, pm1.g1.e1 FROM pm1.g1", new List[] {Arrays.asList(1, "2"), Arrays.asList(3, "4")});
+        dataManager.addData("EXEC pm1.sp2(1)", new List[] {Arrays.asList("b", 2)});
+        ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+        
+        helpProcess(plan, dataManager, expected);
+    }
+    
     private static final boolean DEBUG = false;
 }

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -25,6 +25,8 @@
 import static org.teiid.query.processor.TestProcessor.*;
 
 import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
 import java.sql.Timestamp;
 import java.util.Arrays;
 import java.util.List;
@@ -349,6 +351,16 @@
         processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(blobFromFile("udf.xmi")));
     }
 	
+	@Test public void testXmlParseBlobWithEncoding() throws Exception {
+    	String sql = "select xmlparse(document cast(? as blob)) x"; //$NON-NLS-1$
+    	
+        List[] expected = new List[] {
+        		Arrays.asList(ObjectConverterUtil.convertToString(new InputStreamReader(new FileInputStream(UnitTestUtil.getTestDataFile("encoding.xml")), Charset.forName("ISO-8859-1")))),
+        };    
+    
+        processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(blobFromFile("encoding.xml")));
+    }
+	
     @Test public void testXmlTableTypes() throws Exception {
         String sql = "select * from xmltable('/a' passing xmlparse(document '<a>2000-01-01T01:01:00.2-06:00</a>') columns x timestamp path 'xs:dateTime(./text())', y timestamp path '.') as x"; //$NON-NLS-1$
         Timestamp ts = TimestampUtil.createTimestamp(100, 0, 1, 1, 1, 0, 200000000);

Modified: trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -2655,7 +2655,7 @@
         String userQuery = "EXEC TEIIDSP7(1)"; //$NON-NLS-1$
         HardcodedDataManager dataMgr = new HardcodedDataManager();
         ProcessorPlan plan = getProcedurePlan(userQuery, metadata);
-        dataMgr.addData("VARIABLES.x = EXEC spTest9(1)", new List[] {Arrays.asList(3)});
+        dataMgr.addData("x = EXEC spTest9(1)", new List[] {Arrays.asList(3)});
         dataMgr.addData("EXEC spTest11(3, null)", new List[] {Arrays.asList("1", 1, null), Arrays.asList(null, null, 4)});
         List[] expected = new List[] {Arrays.asList("34")};
         helpTestProcess(plan, expected, dataMgr, metadata);

Modified: trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -350,7 +350,7 @@
      * @param expectedParameterExpressions
      * @since 4.3
      */
-    private void helpResolveExec(String sql, Object[] expectedParameterExpressions) {
+    private StoredProcedure helpResolveExec(String sql, Object[] expectedParameterExpressions) {
 
         StoredProcedure proc = (StoredProcedure)helpResolve(sql);
         
@@ -375,6 +375,8 @@
                 assertEquals(expectedParameterExpressions[i], param.getExpression());
             }
         }
+        
+        return proc;
     }
         
     
@@ -1093,7 +1095,8 @@
     /** test omitting a required parameter that has a default value */
     @Test public void testExecNamedParamsOmitRequiredParamWithDefaultValue() {
         Object[] expectedParameterExpressions = new Object[] {new Constant("xyz"), new Constant(new Integer(666)), new Constant("YYZ")};//$NON-NLS-1$ //$NON-NLS-2$
-        helpResolveExec("EXEC pm1.sq3b(\"in\" = 'xyz', in2 = 666)", expectedParameterExpressions);//$NON-NLS-1$
+        StoredProcedure sp = helpResolveExec("EXEC pm1.sq3b(\"in\" = 'xyz', in2 = 666)", expectedParameterExpressions);//$NON-NLS-1$
+        assertEquals("EXEC pm1.sq3b(\"in\" => 'xyz', in2 => 666)", sp.toString());
     }    
     
     @Test public void testExecNamedParamsOptionalParamWithDefaults() {

Modified: trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -687,8 +687,12 @@
         
     @Test public void testUpdate2() {
         helpValidate("UPDATE test.group SET e0=1, e0=2", new String[] {"e0"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
-    }    
+    }  
     
+    @Test public void testUpdateSubqueryCriteria() {
+        helpValidate("UPDATE vm1.g1 SET e1=1 WHERE exists (select * from vm1.g1)" , new String[] {"EXISTS (SELECT * FROM vm1.g1)"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
     @Test public void testUpdate3() throws Exception {
         QueryMetadataInterface metadata = exampleMetadata();
         

Copied: trunk/engine/src/test/resources/encoding.xml (from rev 2681, branches/7.1.x/engine/src/test/resources/encoding.xml)
===================================================================
--- trunk/engine/src/test/resources/encoding.xml	                        (rev 0)
+++ trunk/engine/src/test/resources/encoding.xml	2010-10-26 14:11:06 UTC (rev 2682)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<name>æåø</name>

Modified: trunk/metadata/src/main/resources/System.vdb
===================================================================
(Binary files differ)

Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -42,7 +42,6 @@
 import org.teiid.adminapi.impl.SourceMappingMetadata;
 import org.teiid.adminapi.impl.VDBMetaData;
 import org.teiid.adminapi.impl.VDBTranslatorMetaData;
-import org.teiid.core.CoreConstants;
 import org.teiid.core.util.FileUtils;
 import org.teiid.dqp.internal.datamgr.ConnectorManager;
 import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;

Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -106,7 +106,7 @@
         return new VDBKey(vdb.getName(), vdb.getVersion());
     } 	
 		
-	public VDBMetaData getVDB(String vdbName) throws VirtualDatabaseException {
+	public VDBMetaData getVDB(String vdbName) {
     	int latestVersion = 0;
         for (VDBKey key:this.vdbRepo.tailMap(new VDBKey(vdbName, 0)).keySet()) {
             if(!key.getName().equalsIgnoreCase(vdbName)) {
@@ -125,7 +125,7 @@
         	}
         }
         if(latestVersion == 0) {
-            throw new VirtualDatabaseException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, "latest")); //$NON-NLS-1$ //$NON-NLS-2$ 
+            return null; 
         }
 
         return getVDB(vdbName, latestVersion);

Modified: trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java	2010-10-26 14:11:06 UTC (rev 2682)
@@ -48,7 +48,6 @@
 import org.teiid.client.security.SessionToken;
 import org.teiid.core.util.ArgCheck;
 import org.teiid.deployers.VDBRepository;
-import org.teiid.deployers.VirtualDatabaseException;
 import org.teiid.dqp.internal.process.DQPCore;
 import org.teiid.dqp.service.SessionService;
 import org.teiid.dqp.service.SessionServiceException;
@@ -221,19 +220,20 @@
 			else {
 				vdb = this.vdbRepository.getVDB(vdbName, Integer.parseInt(vdbVersion));
 			}         
-		} catch (VirtualDatabaseException e) {
-			throw new SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, vdbVersion)); //$NON-NLS-1$ 
 		} catch (NumberFormatException e) {
-			throw new SessionServiceException(e, RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, vdbVersion)); //$NON-NLS-1$
+			throw new SessionServiceException(e, RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._3", vdbVersion)); //$NON-NLS-1$
 		}
 		
 		if (vdb == null) {
 			throw new SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._1", vdbName, vdbVersion)); //$NON-NLS-1$
 		}
 		
-		if (vdb.getStatus() != VDB.Status.ACTIVE || vdb.getConnectionType() == ConnectionType.NONE) {
+		if (vdb.getStatus() != VDB.Status.ACTIVE) {
 			throw new SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, vdbVersion)); //$NON-NLS-1$
 		}
+		if (vdb.getConnectionType() == ConnectionType.NONE) {
+			throw new SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._4", vdbName, vdbVersion)); //$NON-NLS-1$
+		}
 		return vdb;
 	}
 

Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2010-10-26 14:11:06 UTC (rev 2682)
@@ -25,7 +25,9 @@
 LocalBufferService.Failed_initializing_buffer_manager._8=Failed initializing buffer manager.
 
 VDBService.VDB_does_not_exist._1=VDB \"{0}\" version \"{1}\" does not exist.
-VDBService.VDB_does_not_exist._2=VDB \"{0}\" version \"{1}\" is not in "active" status.
+VDBService.VDB_does_not_exist._2=VDB \"{0}\" version \"{1}\" is not in the "active" status.
+VDBService.VDB_does_not_exist._4=VDB \"{0}\" version \"{1}\" is not accepting connections.
+VDBService.VDB_does_not_exist._3=Invalid VDB version \"{0}\" - must be a positive integer.
 
 # session service
 SessionServiceImpl.invalid_session=The specified session ID "{0}" is invalid. It cannot be found in the userbase.

Modified: trunk/test-integration/common/src/test/resources/TestCase3473/testGetTables.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestCase3473/testGetTables.expected	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestCase3473/testGetTables.expected	2010-10-26 14:11:06 UTC (rev 2682)
@@ -12,6 +12,7 @@
 test                                                               SYS                                                                Tables                                                             SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 test                                                               SYS                                                                VirtualDatabases                                                   SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 test                                                               SYSADMIN                                                           MatViews                                                           SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
+test                                                               SYSADMIN                                                           VDBResources                                                       SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 test                                                               pg_catalog                                                         pg_am                                                              SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 test                                                               pg_catalog                                                         pg_attrdef                                                         SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 test                                                               pg_catalog                                                         pg_attribute                                                       SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
@@ -23,7 +24,6 @@
 test                                                               pg_catalog                                                         pg_trigger                                                         SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 test                                                               pg_catalog                                                         pg_type                                                            SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 test                                                               pg_catalog                                                         pg_user                                                            SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
-test                                                               SYSADMIN                                                           VDBResources                                                       TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 test                                                               test                                                               all_databases                                                      TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 test                                                               test                                                               all_models                                                         TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 test                                                               test                                                               all_tables                                                         TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     

Modified: trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables.expected	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables.expected	2010-10-26 14:11:06 UTC (rev 2682)
@@ -30,6 +30,7 @@
 QT_Ora9DS                                                          SYS                                                                Tables                                                             SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          SYS                                                                VirtualDatabases                                                   SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          SYSADMIN                                                           MatViews                                                           SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
+QT_Ora9DS                                                          SYSADMIN                                                           VDBResources                                                       SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          pg_catalog                                                         pg_am                                                              SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          pg_catalog                                                         pg_attrdef                                                         SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          pg_catalog                                                         pg_attribute                                                       SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
@@ -57,7 +58,6 @@
 QT_Ora9DS                                                          BQT2                                                               MediumB                                                            TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          BQT2                                                               SmallA                                                             TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          BQT2                                                               SmallB                                                             TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
-QT_Ora9DS                                                          SYSADMIN                                                           VDBResources                                                       TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          VQT                                                                Base.Agg1                                                          TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          VQT                                                                Base.Agg2                                                          TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          VQT                                                                Base.Agg3                                                          TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     

Modified: trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_allTables.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_allTables.expected	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_allTables.expected	2010-10-26 14:11:06 UTC (rev 2682)
@@ -30,6 +30,7 @@
 QT_Ora9DS                                                          SYS                                                                Tables                                                             SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          SYS                                                                VirtualDatabases                                                   SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          SYSADMIN                                                           MatViews                                                           SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
+QT_Ora9DS                                                          SYSADMIN                                                           VDBResources                                                       SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          pg_catalog                                                         pg_am                                                              SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          pg_catalog                                                         pg_attrdef                                                         SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          pg_catalog                                                         pg_attribute                                                       SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
@@ -57,7 +58,6 @@
 QT_Ora9DS                                                          BQT2                                                               MediumB                                                            TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          BQT2                                                               SmallA                                                             TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          BQT2                                                               SmallB                                                             TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
-QT_Ora9DS                                                          SYSADMIN                                                           VDBResources                                                       TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          VQT                                                                Base.Agg1                                                          TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          VQT                                                                Base.Agg2                                                          TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          VQT                                                                Base.Agg3                                                          TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     

Modified: trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableMultipleTypes.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableMultipleTypes.expected	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableMultipleTypes.expected	2010-10-26 14:11:06 UTC (rev 2682)
@@ -16,7 +16,6 @@
 QT_Ora9DS                                                          BQT2                                                               MediumB                                                            TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          BQT2                                                               SmallA                                                             TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          BQT2                                                               SmallB                                                             TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
-QT_Ora9DS                                                          SYSADMIN                                                           VDBResources                                                       TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          VQT                                                                Base.Agg1                                                          TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          VQT                                                                Base.Agg2                                                          TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          VQT                                                                Base.Agg3                                                          TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
@@ -50,7 +49,7 @@
 QT_Ora9DS                                                          VQT                                                                Union.U9                                                           TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          XQT                                                                xqtData                                                            TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          XQT                                                                xqtFullData                                                        TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
-Row Count : 50
+Row Count : 49
 getColumnName              getColumnType  getCatalogName  getColumnClassName  getColumnLabel             getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  
 TABLE_CAT                  12             QT_Ora9DS       java.lang.String    TABLE_CAT                  string             SYS            Tables        255                   255           0         false            true             false       true                  1           false       true          true      true        
 TABLE_SCHEM                12             QT_Ora9DS       java.lang.String    TABLE_SCHEM                string             SYS            Tables        255                   255           0         false            true             false       true                  1           false       true          true      true        

Modified: trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableTypes.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableTypes.expected	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableTypes.expected	2010-10-26 14:11:06 UTC (rev 2682)
@@ -16,7 +16,6 @@
 QT_Ora9DS                                                          BQT2                                                               MediumB                                                            TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          BQT2                                                               SmallA                                                             TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          BQT2                                                               SmallB                                                             TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
-QT_Ora9DS                                                          SYSADMIN                                                           VDBResources                                                       TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 QT_Ora9DS                                                          VQT                                                                Base.Agg1                                                          TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          VQT                                                                Base.Agg2                                                          TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          VQT                                                                Base.Agg3                                                          TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
@@ -50,7 +49,7 @@
 QT_Ora9DS                                                          VQT                                                                Union.U9                                                           TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          XQT                                                                xqtData                                                            TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 QT_Ora9DS                                                          XQT                                                                xqtFullData                                                        TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
-Row Count : 50
+Row Count : 49
 getColumnName              getColumnType  getCatalogName  getColumnClassName  getColumnLabel             getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  
 TABLE_CAT                  12             QT_Ora9DS       java.lang.String    TABLE_CAT                  string             SYS            Tables        255                   255           0         false            true             false       true                  1           false       true          true      true        
 TABLE_SCHEM                12             QT_Ora9DS       java.lang.String    TABLE_SCHEM                string             SYS            Tables        255                   255           0         false            true             false       true                  1           false       true          true      true        

Modified: trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testTables.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testTables.expected	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testTables.expected	2010-10-26 14:11:06 UTC (rev 2682)
@@ -12,6 +12,7 @@
 PartsSupplier                                                      SYS                                                                Tables                                                             SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 PartsSupplier                                                      SYS                                                                VirtualDatabases                                                   SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
+PartsSupplier                                                      SYSADMIN                                                           VDBResources                                                       SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 PartsSupplier                                                      pg_catalog                                                         pg_am                                                              SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 PartsSupplier                                                      pg_catalog                                                         pg_attrdef                                                         SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
 PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       SYSTEM TABLE                                                       <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             false     
@@ -28,7 +29,6 @@
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.STATUS                                               TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
-PartsSupplier                                                      SYSADMIN                                                           VDBResources                                                       TABLE                                                              <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             <null>                                                             true      
 Row Count : 29
 getColumnName              getColumnType  getCatalogName  getColumnClassName  getColumnLabel             getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  
 TABLE_CAT                  12             PartsSupplier   java.lang.String    TABLE_CAT                  string             SYS            Tables        255                   255           0         false            true             false       true                  1           false       true          true      true        

Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected	2010-10-26 14:11:06 UTC (rev 2682)
@@ -1,7 +1,7 @@
 string                                                             string                                                             string                                                             string                                                             integer      string                                                             string                                                             integer      integer      boolean        boolean         boolean          boolean          boolean   boolean     boolean            string                string                                              string                                              string                string                                                             string                                                             string                                                             integer      integer          integer      string                                           !
    string                                                             integer    
 VDBName                                                            SchemaName                                                         TableName                                                          Name                                                               Position     NameInSource                                                       DataType                                                           Scale        Length       IsLengthFixed  SupportsSelect  SupportsUpdates  IsCaseSensitive  IsSigned  IsCurrency  IsAutoIncremented  NullType              MinRange                                            MaxRange                                            SearchType            Format                                                             DefaultValue                                                       JavaClass                                                          Precision    CharOctetLength  Radix        UID                                              !
    Description                                                        OID        
 PartsSupplier                                                      SYS                                                                DataTypes                                                          BaseType                                                           17           <null>                                                             string                                                             0            64           true           true            false            true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   64           64               10           mmuuid:03beb57c-968b-4821-a6ae-cb1154cfadee      !
    <null>                                                             73         
-PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           Cardinality                                                        9            <null>                                                             integer                                                            0            10           false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  10           10               10           mmuuid:abe699b0-b6bc-4413-9172-0a21ca9664d2      !
    <null>                                                             25         
+PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           Cardinality                                                        9            <null>                                                             integer                                                            0            10           false          true            false            true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  10           10               10           mmuuid:abe699b0-b6bc-4413-9172-0a21ca9664d2      !
    <null>                                                             25         
 PartsSupplier                                                      SYS                                                                Tables                                                             Cardinality                                                        9            <null>                                                             integer                                                            0            10           false          true            false            true             true      false       false              No Nulls              <null>                                              <null>                                              All Except Like       <null>                                                             <null>                                                             java.lang.Integer                                                  10           10               10           mmuuid:24cdad3a-e8f7-4376-bb32-79f8bc8eeed2      !
    <null>                                                             154        
 PartsSupplier                                                      SYS                                                                Columns                                                            CharOctetLength                                                    25           <null>                                                             integer                                                            0            10           true           true            false            false            false     false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  10           10               10           mmuuid:de5def94-2804-4c91-91ed-26d630ce8afe      !
    <null>                                                             52         
 PartsSupplier                                                      SYS                                                                ReferenceKeyColumns                                                DEFERRABILITY                                                      14           <null>                                                             integer                                                            0            10           false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  10           10               10           mmuuid:88380f55-2cbd-4325-b9a3-9dcaa88a690e      !
    <null>                                                             138        
@@ -43,10 +43,10 @@
 PartsSupplier                                                      SYS                                                                KeyColumns                                                         KeyName                                                            5            <null>                                                             string                                                             0            255          true           true            false            false            false     false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   255          255              10           mmuuid:da4bef58-83f4-4b88-8bb0-2dc8990be539      !
    <null>                                                             80         
 PartsSupplier                                                      SYS                                                                KeyColumns                                                         KeyType                                                            6            <null>                                                             string                                                             0            20           true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   20           20               10           mmuuid:df9e15e6-ab77-486d-bfe0-0adc378aa99d      !
    <null>                                                             81         
 PartsSupplier                                                      SYS                                                                Columns                                                            Length                                                             9            <null>                                                             integer                                                            0            10           true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  10           10               10           mmuuid:b36ea0f6-cbff-4049-bc9c-8ec9928be048      !
    <null>                                                             36         
-PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           LoadState                                                          7            <null>                                                             string                                                             0            255          false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:c67365c3-f252-40f4-aae6-8971d3b1b153      !
    <null>                                                             23         
+PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           LoadState                                                          7            <null>                                                             string                                                             0            255          false          true            false            true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:c67365c3-f252-40f4-aae6-8971d3b1b153      !
    <null>                                                             23         
 PartsSupplier                                                      SYS                                                                Columns                                                            MaxRange                                                           19           <null>                                                             string                                                             0            50           true           true            false            false            false     false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   50           50               10           mmuuid:0b0df4a5-7de5-4315-94f7-22c84958302e      !
    <null>                                                             46         
 PartsSupplier                                                      SYS                                                                Columns                                                            MinRange                                                           18           <null>                                                             string                                                             0            50           true           true            false            false            false     false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   50           50               10           mmuuid:dba0f97d-fab5-45f6-a1eb-3459ab3fcc74      !
    <null>                                                             45         
-PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           Name                                                               3            <null>                                                             string                                                             0            255          false          true            true             true             true      false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:0f56d35c-e450-4b4f-86b0-bdb4f1015c57      !
    <null>                                                             19         
+PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           Name                                                               3            <null>                                                             string                                                             0            255          false          true            false            true             true      false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:0f56d35c-e450-4b4f-86b0-bdb4f1015c57      !
    <null>                                                             19         
 PartsSupplier                                                      SYS                                                                Columns                                                            Name                                                               4            <null>                                                             string                                                             0            255          true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   255          255              10           mmuuid:d1f44a6d-3e39-4251-b873-1280c2b035b3      !
    <null>                                                             31         
 PartsSupplier                                                      SYS                                                                DataTypes                                                          Name                                                               1            <null>                                                             string                                                             0            100          true           true            false            true             true      false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   100          100              10           mmuuid:17f7de33-e6f0-4b9c-b55e-a87f6b7bb9b3      !
    <null>                                                             57         
 PartsSupplier                                                      SYS                                                                KeyColumns                                                         Name                                                               4            <null>                                                             string                                                             0            255          true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   255          255              10           mmuuid:08bda0c7-5f66-4fed-8285-d74b63eeb0e2      !
    <null>                                                             79         
@@ -114,7 +114,7 @@
 PartsSupplier                                                      SYS                                                                Columns                                                            Scale                                                              8            <null>                                                             integer                                                            0            10           true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  10           10               10           mmuuid:cc6c6113-8d70-40c8-84c0-94e17c14e22e      !
    <null>                                                             35         
 PartsSupplier                                                      SYS                                                                DataTypes                                                          Scale                                                              6            <null>                                                             integer                                                            0            10           true           true            false            false            false     false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             (0)                                                                java.lang.Integer                                                  10           10               10           mmuuid:e8655204-e97a-45cd-909b-1e37731e9546      !
    <null>                                                             62         
 PartsSupplier                                                      SYS                                                                ProcedureParams                                                    Scale                                                              11           <null>                                                             integer                                                            0            10           true           true            true             false            false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             (0)                                                                java.lang.Integer                                                  10           10               10           mmuuid:360c8b1d-4b3d-42fd-952c-bf5763cad69e      !
    <null>                                                             107        
-PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           SchemaName                                                         2            <null>                                                             string                                                             0            255          false          true            true             true             true      false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:2738c484-d24d-4c40-b0b7-e734afb03450      !
    <null>                                                             18         
+PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           SchemaName                                                         2            <null>                                                             string                                                             0            255          false          true            false            true             true      false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:2738c484-d24d-4c40-b0b7-e734afb03450      !
    <null>                                                             18         
 PartsSupplier                                                      SYS                                                                Columns                                                            SchemaName                                                         2            <null>                                                             string                                                             0            255          false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:859288c9-cd78-4407-90fc-61b5d310e2ab      !
    <null>                                                             29         
 PartsSupplier                                                      SYS                                                                KeyColumns                                                         SchemaName                                                         2            <null>                                                             string                                                             0            255          false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:787be966-cf12-4956-907f-a8e6dc1009dc      !
    <null>                                                             77         
 PartsSupplier                                                      SYS                                                                Keys                                                               SchemaName                                                         2            <null>                                                             string                                                             0            255          false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:4a7fc059-208e-4f98-b6ef-cb7c6102a327      !
    <null>                                                             87         
@@ -129,8 +129,8 @@
 PartsSupplier                                                      SYS                                                                Columns                                                            TableName                                                          3            <null>                                                             string                                                             0            255          true           true            false            true             false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   255          255              10           mmuuid:2c09c9d1-2f25-45de-81cf-eeb2a5157d34      !
    <null>                                                             30         
 PartsSupplier                                                      SYS                                                                KeyColumns                                                         TableName                                                          3            <null>                                                             string                                                             0            2048         true           true            false            true             false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   2048         2048             10           mmuuid:c24fad72-0c0d-4260-96ae-f188ad77b137      !
    <null>                                                             78         
 PartsSupplier                                                      SYS                                                                Keys                                                               TableName                                                          3            <null>                                                             string                                                             0            2048         true           true            false            true             false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   2048         2048             10           mmuuid:7d9540bd-b51f-4206-8c33-b39c5ba8bb8b      !
    <null>                                                             88         
-PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           TargetName                                                         5            <null>                                                             string                                                             0            4000         false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            4000             10           mmuuid:d2831595-d6f5-4cca-aa5d-2ff2530d0ab1      !
    <null>                                                             21         
-PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           TargetSchemaName                                                   4            <null>                                                             string                                                             0            255          false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:a95dba1c-283e-4f48-9671-34cecdb7d0e3      !
    <null>                                                             20         
+PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           TargetName                                                         5            <null>                                                             string                                                             0            4000         false          true            false            true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            4000             10           mmuuid:d2831595-d6f5-4cca-aa5d-2ff2530d0ab1      !
    <null>                                                             21         
+PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           TargetSchemaName                                                   4            <null>                                                             string                                                             0            255          false          true            false            true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:a95dba1c-283e-4f48-9671-34cecdb7d0e3      !
    <null>                                                             20         
 PartsSupplier                                                      SYS                                                                Keys                                                               Type                                                               7            <null>                                                             string                                                             0            20           true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   20           20               10           mmuuid:29e73c18-afec-43a9-81ab-7378d6daf20b      !
    <null>                                                             92         
 PartsSupplier                                                      SYS                                                                ProcedureParams                                                    Type                                                               7            <null>                                                             string                                                             0            100          true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   100          100              10           mmuuid:76a1981b-1226-4a55-9acf-82a061cc8642      !
    <null>                                                             103        
 PartsSupplier                                                      SYS                                                                Tables                                                             Type                                                               4            <null>                                                             string                                                             0            20           true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   20           20               10           mmuuid:4814a0af-4e8f-4f55-9b25-3148d90d3d9b      !
    <null>                                                             149        
@@ -147,8 +147,8 @@
 PartsSupplier                                                      SYS                                                                Schemas                                                            UID                                                                4            <null>                                                             string                                                             0            50           true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   50           50               10           mmuuid:ad232e4d-9c01-4d0c-bc57-0459d9db918a      !
    <null>                                                             142        
 PartsSupplier                                                      SYS                                                                Tables                                                             UID                                                                8            <null>                                                             string                                                             0            50           true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   50           50               10           mmuuid:6afe3737-26f9-43a8-88db-86531b5dc66c      !
    <null>                                                             153        
 PartsSupplier                                                      SYS                                                                ReferenceKeyColumns                                                UPDATE_RULE                                                        10           <null>                                                             integer                                                            0            10           false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  10           10               10           mmuuid:30d5ae74-b19e-4186-97e1-aeff5801e44f      !
    <null>                                                             134        
-PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           Updated                                                            8            <null>                                                             timestamp                                                          0            0            false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.sql.Timestamp                                                 0            0                10           mmuuid:33970a66-7ad4-411f-a6c4-545746747fe6      !
    <null>                                                             24         
-PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           VDBName                                                            1            <null>                                                             string                                                             0            255          false          true            true             true             true      false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:c1ce9841-e272-4839-8c78-777a5f68d241      !
    <null>                                                             17         
+PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           Updated                                                            8            <null>                                                             timestamp                                                          0            0            false          true            false            true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.sql.Timestamp                                                 0            0                10           mmuuid:33970a66-7ad4-411f-a6c4-545746747fe6      !
    <null>                                                             24         
+PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           VDBName                                                            1            <null>                                                             string                                                             0            255          false          true            false            true             true      false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:c1ce9841-e272-4839-8c78-777a5f68d241      !
    <null>                                                             17         
 PartsSupplier                                                      SYS                                                                Columns                                                            VDBName                                                            1            <null>                                                             string                                                             0            255          true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   255          255              10           mmuuid:83f19a81-1243-4751-8c99-daddbf37b1d7      !
    <null>                                                             28         
 PartsSupplier                                                      SYS                                                                KeyColumns                                                         VDBName                                                            1            <null>                                                             string                                                             0            255          true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   255          255              10           mmuuid:f062eb9c-4854-47fb-b7bd-a4e23c782b62      !
    <null>                                                             76         
 PartsSupplier                                                      SYS                                                                Keys                                                               VDBName                                                            1            <null>                                                             string                                                             0            255          true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   255          255              10           mmuuid:5785b523-7da3-42c1-8920-66daa1f7fa1d      !
    <null>                                                             86         
@@ -156,7 +156,7 @@
 PartsSupplier                                                      SYS                                                                Procedures                                                         VDBName                                                            1            <null>                                                             string                                                             0            255          true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   255          255              10           mmuuid:1d664747-4a95-4605-8b28-381bed3121f1      !
    <null>                                                             113        
 PartsSupplier                                                      SYS                                                                Schemas                                                            VDBName                                                            1            <null>                                                             string                                                             0            255          false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:73dbf95b-a283-4f0a-81b9-9b98e09c2906      !
    <null>                                                             139        
 PartsSupplier                                                      SYS                                                                Tables                                                             VDBName                                                            1            <null>                                                             string                                                             0            255          false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:58de905f-9d64-4831-a985-da6d082ff709      !
    <null>                                                             146        
-PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           Valid                                                              6            <null>                                                             boolean                                                            0            0            false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                10           mmuuid:13098912-bce2-4842-9ea9-b162fcd7383e      !
    <null>                                                             22         
+PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           Valid                                                              6            <null>                                                             boolean                                                            0            0            false          true            false            true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                10           mmuuid:13098912-bce2-4842-9ea9-b162fcd7383e      !
    <null>                                                             22         
 PartsSupplier                                                      SYS                                                                Properties                                                         Value                                                              2            <null>                                                             string                                                             0            255          true           true            false            true             true      false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   255          255              10           mmuuid:c917257d-06b7-41dd-a6cb-44c0ff0f897e      !
    <null>                                                             122        
 PartsSupplier                                                      SYS                                                                VirtualDatabases                                                   Version                                                            2            <null>                                                             string                                                             0            50           true           true            false            true             false     false       false              No Nulls              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   50           50               10           mmuuid:c876d749-a512-4810-9910-3034ca524c45      !
    <null>                                                             160        
 PartsSupplier                                                      pg_catalog                                                         pg_attrdef                                                         adnum                                                              4            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:e22c521a-e208-4181-9dbd-89f5de7014b9       !
    <null>                                                             222        
@@ -172,7 +172,7 @@
 PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       attrelid                                                           2            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:3be6b5de-2287-4279-93f3-4f5064799118       !
    <null>                                                             173        
 PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       atttypid                                                           4            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:99782493-1cce-4e14-9c1b-4de7ce50e2c8       !
    <null>                                                             175        
 PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       atttypmod                                                          7            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:2e2bae3c-ab93-49f5-b96c-7a7b9d66782d       !
    <null>                                                             178        
-PartsSupplier                                                      SYSADMIN                                                           VDBResources                                                       contents                                                           2            <null>                                                             blob                                                               0            0            false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             org.teiid.core.types.BlobType                                      0            0                10           mmuuid:f9421669-3564-451d-9293-96c1e5e72c4f      !
    <null>                                                             27         
+PartsSupplier                                                      SYSADMIN                                                           VDBResources                                                       contents                                                           2            <null>                                                             blob                                                               0            0            false          true            false            true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             org.teiid.core.types.BlobType                                      0            0                10           mmuuid:f9421669-3564-451d-9293-96c1e5e72c4f      !
    <null>                                                             27         
 PartsSupplier                                                      pg_catalog                                                         pg_database                                                        datacl                                                             7            <null>                                                             object                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Object                                                   0            0                0            mmuid:4b5beb14-03a0-4652-9d6f-5f8cc74d470c       !
    <null>                                                             229        
 PartsSupplier                                                      pg_catalog                                                         pg_database                                                        datallowconn                                                       5            <null>                                                             char                                                               0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Character                                                0            0                0            mmuid:c2bdf40c-ec58-439c-a403-7adf604ceadd       !
    <null>                                                             227        
 PartsSupplier                                                      pg_catalog                                                         pg_database                                                        datconfig                                                          6            <null>                                                             object                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Object                                                   0            0                0            mmuid:5c9d54b2-433f-443a-85ce-821f42ed109e       !
    <null>                                                             228        
@@ -217,7 +217,7 @@
 PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relnamespace                                                       3            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:4591ef08-bff8-4f3b-9de7-420f9c7f9d2b       !
    <null>                                                             165        
 PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relpages                                                           7            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:44dee7d6-b6ae-44c7-85f2-e87364d8d059       !
    <null>                                                             169        
 PartsSupplier                                                      pg_catalog                                                         pg_class                                                           reltuples                                                          6            <null>                                                             float                                                              0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Float                                                    0            0                0            mmuid:b9ed4b49-5a7b-4ba4-863a-37fd95b2a34c       !
    <null>                                                             168        
-PartsSupplier                                                      SYSADMIN                                                           VDBResources                                                       resourcePath                                                       1            <null>                                                             string                                                             0            255          false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:b1bc5150-3dcc-452e-9e75-4a506997f612      !
    <null>                                                             26         
+PartsSupplier                                                      SYSADMIN                                                           VDBResources                                                       resourcePath                                                       1            <null>                                                             string                                                             0            255          false          true            false            true             true      false       false              Nullable              <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:b1bc5150-3dcc-452e-9e75-4a506997f612      !
    <null>                                                             26         
 PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgargs                                                             4            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:250d7c06-728a-4b2a-b557-91f2a69bb184       !
    <null>                                                             213        
 PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgconstrname                                                       8            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:da4b59ca-ebff-45a8-ad68-9777bc587813       !
    <null>                                                             217        
 PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgconstrrelid                                                      2            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:635b6634-632c-43c9-8cc7-bcaa016133e8       !
    <null>                                                             211        

Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTableIsSystem.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTableIsSystem.expected	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTableIsSystem.expected	2010-10-26 14:11:06 UTC (rev 2682)
@@ -5,7 +5,6 @@
 PARTSSUPPLIER.STATUS                                             
 PARTSSUPPLIER.SUPPLIER                                           
 PARTSSUPPLIER.SUPPLIER_PARTS                                     
-VDBResources                                                     
-Row Count : 6
+Row Count : 5
 getColumnName  getColumnType  getCatalogName  getColumnClassName  getColumnLabel  getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  
 Name           12             PartsSupplier   java.lang.String    Name            string             SYS            Tables        255                   255           0         false            true             false       false                 0           true        true          false     false       

Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected	2010-10-26 14:11:06 UTC (rev 2682)
@@ -4,7 +4,7 @@
 PartsSupplier                                                      SYS                                                                DataTypes                                                          Table                 <null>                                                             true        false            mmuuid:9a8794f9-66f8-49e8-8576-89d212d0f957         0            <null>                                                             true      false           8          
 PartsSupplier                                                      SYS                                                                KeyColumns                                                         Table                 <null>                                                             true        false            mmuuid:14946083-3bd5-42d5-8283-1c0694347c29         0            <null>                                                             true      false           9          
 PartsSupplier                                                      SYS                                                                Keys                                                               Table                 <null>                                                             true        false            mmuuid:1e5135dc-ce5d-4b25-a8ff-63f5440b3108         0            <null>                                                             true      false           10         
-PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           Table                 <null>                                                             true        true             mmuuid:520ba1e8-3553-460f-8d18-9b43f089e256         0            <null>                                                             true      false           5          
+PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           Table                 <null>                                                             true        false            mmuuid:520ba1e8-3553-460f-8d18-9b43f089e256         0            <null>                                                             true      false           5          
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.PARTS                                                Table                 PARTS                                                              true        true             mmuuid:f6276601-73fe-1edc-a81c-ecf397b10590         16           <null>                                                             false     false           0          
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SHIP_VIA                                             Table                 SHIP_VIA                                                           true        true             mmuuid:0f4e9b80-73ff-1edc-a81c-ecf397b10590         4            <null>                                                             false     false           1          
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.STATUS                                               Table                 STATUS                                                             true        true             mmuuid:1f297200-73ff-1edc-a81c-ecf397b10590         3            <null>                                                             false     false           2          
@@ -16,7 +16,7 @@
 PartsSupplier                                                      SYS                                                                ReferenceKeyColumns                                                Table                 <null>                                                             true        false            mmuuid:6a9653e8-a337-41b2-86fa-77b98f409a29         0            <null>                                                             true      false           14         
 PartsSupplier                                                      SYS                                                                Schemas                                                            Table                 <null>                                                             true        false            mmuuid:8648a554-b2ad-4e8e-84ca-2ec618b311a9         0            <null>                                                             true      false           15         
 PartsSupplier                                                      SYS                                                                Tables                                                             Table                 <null>                                                             true        false            mmuuid:8551b3bd-11cc-4049-9bcf-fe91a0eb7ba7         0            <null>                                                             true      false           16         
-PartsSupplier                                                      SYSADMIN                                                           VDBResources                                                       Table                 <null>                                                             true        true             mmuuid:1785804d-beaf-4831-9531-e59164fedd49         0            <null>                                                             false     false           6          
+PartsSupplier                                                      SYSADMIN                                                           VDBResources                                                       Table                 <null>                                                             true        false            mmuuid:1785804d-beaf-4831-9531-e59164fedd49         0            <null>                                                             true      false           6          
 PartsSupplier                                                      SYS                                                                VirtualDatabases                                                   Table                 <null>                                                             true        false            mmuuid:47297c72-d621-4f4e-af4e-74060ac5f489         0            <null>                                                             true      false           17         
 PartsSupplier                                                      pg_catalog                                                         pg_am                                                              Table                 <null>                                                             false       false            mmuid:1462b28e-0bab-436f-9654-013821506337          0            <null>                                                             true      false           23         
 PartsSupplier                                                      pg_catalog                                                         pg_attrdef                                                         Table                 <null>                                                             false       false            mmuid:71091853-c65e-46a9-9947-aa024f806e2d          0            <null>                                                             true      false           26         

Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testVDBResources.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testVDBResources.expected	2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testVDBResources.expected	2010-10-26 14:11:06 UTC (rev 2682)
@@ -22,5 +22,5 @@
 /runtime-inf/VDBS.INDEX                                            Blob[24924]                                                      
 Row Count : 20
 getColumnName  getColumnType  getCatalogName  getColumnClassName  getColumnLabel  getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  
-resourcePath   12             PartsSupplier   java.lang.String    resourcePath    string             SYSADMIN       VDBResources  255                   255           0         false            true             false       true                  1           false       true          true      true        
-contents       2004           PartsSupplier   java.sql.Blob       contents        blob               SYSADMIN       VDBResources  2147483647            2147483647    0         false            true             false       true                  1           false       true          true      true        
+resourcePath   12             PartsSupplier   java.lang.String    resourcePath    string             SYSADMIN       VDBResources  255                   255           0         false            true             false       false                 1           true        true          true      false       
+contents       2004           PartsSupplier   java.sql.Blob       contents        blob               SYSADMIN       VDBResources  2147483647            2147483647    0         false            true             false       false                 1           true        true          true      false       



More information about the teiid-commits mailing list