Author: shawkins
Date: 2009-07-11 11:27:48 -0400 (Sat, 11 Jul 2009)
New Revision: 1120
Added:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/BaseColumn.java
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnRecordImpl.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSetRecordImpl.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ConnectorMetadata.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameterRecordImpl.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureRecordImpl.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/TableRecordImpl.java
trunk/connector-api/src/main/resources/org/teiid/connector/i18n.properties
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java
trunk/engine/src/main/java/com/metamatrix/query/metadata/MetadataStore.java
trunk/metadata/src/main/java/org/teiid/metadata/CompositeMetadataStore.java
trunk/metadata/src/main/java/org/teiid/metadata/ConnectorMetadataStore.java
trunk/metadata/src/main/java/org/teiid/metadata/TransformationMetadata.java
trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataStore.java
trunk/metadata/src/main/java/org/teiid/metadata/index/RecordFactory.java
trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestVDBLessExecution.java
Log:
TEIID-714 TEIID-687 TEIID-685 TEIID-684 adding the ability to import procedures and fixing
the DatabaseMetadata.getProcedures call.
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java 2009-07-10
20:48:29 UTC (rev 1119)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -264,7 +264,7 @@
.append(RUNTIME_MODEL.VIRTUAL_MODEL_NAME)
.append(".Procedures as p CROSS JOIN ") //$NON-NLS-1$
.append(RUNTIME_MODEL.VIRTUAL_MODEL_NAME)
- .append(".VirtualDatabases v WHERE
UCASE(v.Name)").append(LIKE_ESCAPE).append("AND
UCASE(p.Name)").append(LIKE_ESCAPE) //$NON-NLS-1$//$NON-NLS-2$
+ .append(".VirtualDatabases v WHERE
UCASE(v.Name)").append(LIKE_ESCAPE).append("AND
UCASE(p.FullName)").append(LIKE_ESCAPE) //$NON-NLS-1$//$NON-NLS-2$
.append(" ORDER BY PROCEDURE_SCHEM, PROCEDURE_NAME").toString();
//$NON-NLS-1$
private final static String QUERY_PROCEDURE_COLUMNS =
Added:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/BaseColumn.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/BaseColumn.java
(rev 0)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/BaseColumn.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.connector.metadata.runtime;
+
+public class BaseColumn extends AbstractMetadataRecord {
+
+ private String datatypeUUID;
+ private String runtimeType;
+ private Object defaultValue;
+ private int length;
+ private int scale;
+ private int radix;
+ private int precision;
+ private int nullType;
+ private int position;
+ private DatatypeRecordImpl datatype;
+
+ public Object getDefaultValue() {
+ return defaultValue;
+ }
+
+ public String getDatatypeUUID() {
+ return datatypeUUID;
+ }
+
+ public String getRuntimeType() {
+ return runtimeType;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ public int getPrecision() {
+ return precision;
+ }
+
+ public int getScale() {
+ return scale;
+ }
+
+ public int getRadix() {
+ return radix;
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+ public int getNullType() {
+ return nullType;
+ }
+
+ public void setLength(int i) {
+ length = i;
+ }
+
+ public void setPrecision(int i) {
+ precision = i;
+ }
+
+ public void setScale(int i) {
+ scale = i;
+ }
+
+ public void setRadix(int i) {
+ radix = i;
+ }
+
+ public void setNullType(int i) {
+ nullType = i;
+ }
+
+ public void setPosition(int i) {
+ position = i;
+ }
+
+ public void setRuntimeType(String string) {
+ runtimeType = string;
+ }
+
+ public void setDatatypeUUID(String string) {
+ datatypeUUID = string;
+ }
+
+ public void setDefaultValue(Object object) {
+ defaultValue = object;
+ }
+
+ public DatatypeRecordImpl getDatatype() {
+ return datatype;
+ }
+
+ public void setDatatype(DatatypeRecordImpl datatype) {
+ this.datatype = datatype;
+ }
+
+}
Property changes on:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/BaseColumn.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnRecordImpl.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnRecordImpl.java 2009-07-10
20:48:29 UTC (rev 1119)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnRecordImpl.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -25,10 +25,9 @@
/**
* ColumnRecordImpl
*/
-public class ColumnRecordImpl extends AbstractMetadataRecord implements
Comparable<ColumnRecordImpl> {
+public class ColumnRecordImpl extends BaseColumn implements
Comparable<ColumnRecordImpl> {
- private String datatypeUUID;
- private boolean selectable;
+ private boolean selectable = true;
private boolean updatable;
private boolean autoIncrementable;
private boolean caseSensitive;
@@ -37,22 +36,13 @@
private boolean fixedLength;
private boolean tranformationInputParameter;
private int searchType;
- private Object defaultValue;
private Object minValue;
private Object maxValue;
- private int length;
- private int scale;
- private int nullType;
- private String runtimeTypeName;
private String nativeType;
private String format;
- private int precision;
private int charOctetLength;
- private int position;
- private int radix;
- private int distinctValues;
- private int nullValues;
- private DatatypeRecordImpl datatype;
+ private int distinctValues = -1;
+ private int nullValues = -1;
//==================================================================================
// I N T E R F A C E M E T H O D S
@@ -71,34 +61,6 @@
}
/* (non-Javadoc)
- * @see com.metamatrix.modeler.core.metadata.runtime.ColumnRecord#getRuntimeType()
- */
- public String getRuntimeType() {
- return runtimeTypeName;
- }
-
- /* (non-Javadoc)
- * @see com.metamatrix.modeler.core.metadata.runtime.ColumnRecord#getDatatypeUUID()
- */
- public String getDatatypeUUID() {
- return datatypeUUID;
- }
-
- /* (non-Javadoc)
- * @see com.metamatrix.modeler.core.metadata.runtime.ColumnRecord#getDefaultValue()
- */
- public Object getDefaultValue() {
- return defaultValue;
- }
-
- /* (non-Javadoc)
- * @see com.metamatrix.modeler.core.metadata.runtime.ColumnRecord#getLength()
- */
- public int getLength() {
- return length;
- }
-
- /* (non-Javadoc)
* @see com.metamatrix.modeler.core.metadata.runtime.ColumnRecord#getMaxValue()
*/
public Object getMaxValue() {
@@ -113,27 +75,6 @@
}
/* (non-Javadoc)
- * @see com.metamatrix.modeler.core.metadata.runtime.ColumnRecord#getPrecision()
- */
- public int getPrecision() {
- return precision;
- }
-
- /* (non-Javadoc)
- * @see com.metamatrix.modeler.core.metadata.runtime.ColumnRecord#getPosition()
- */
- public int getPosition() {
- return position;
- }
-
- /* (non-Javadoc)
- * @see com.metamatrix.modeler.core.metadata.runtime.ColumnRecord#getScale()
- */
- public int getScale() {
- return scale;
- }
-
- /* (non-Javadoc)
* @see com.metamatrix.modeler.core.metadata.runtime.ColumnRecord#getSearchTye()
*/
public int getSearchType() {
@@ -183,13 +124,6 @@
return tranformationInputParameter;
}
- /**
- * @return
- */
- public int getNullType() {
- return nullType;
- }
-
/* (non-Javadoc)
* @see com.metamatrix.modeler.core.metadata.runtime.ColumnRecord#isSelectable()
*/
@@ -211,13 +145,6 @@
return updatable;
}
- /* (non-Javadoc)
- * @see com.metamatrix.modeler.core.metadata.runtime.ColumnRecord#getRadix()
- */
- public int getRadix() {
- return radix;
- }
-
/**
* @see com.metamatrix.modeler.core.metadata.runtime.ColumnRecord#getNativeType()
* @since 4.2
@@ -275,27 +202,6 @@
}
/**
- * @param string
- */
- public void setRuntimeType(String string) {
- runtimeTypeName = string;
- }
-
- /**
- * @param string
- */
- public void setDatatypeUUID(String string) {
- datatypeUUID = string;
- }
-
- /**
- * @param object
- */
- public void setDefaultValue(Object object) {
- defaultValue = object;
- }
-
- /**
* @param b
*/
public void setFixedLength(boolean b) {
@@ -303,20 +209,6 @@
}
/**
- * @param i
- */
- public void setLength(int i) {
- length = i;
- }
-
- /**
- * @param i
- */
- public void setNullType(int i) {
- nullType = i;
- }
-
- /**
* @param object
*/
public void setMaxValue(Object object) {
@@ -331,27 +223,6 @@
}
/**
- * @param i
- */
- public void setPrecision(int i) {
- precision = i;
- }
-
- /**
- * @param i
- */
- public void setPosition(int i) {
- position = i;
- }
-
- /**
- * @param i
- */
- public void setScale(int i) {
- scale = i;
- }
-
- /**
* @param s
*/
public void setSearchType(int s) {
@@ -380,13 +251,6 @@
}
/**
- * @param i
- */
- public void setRadix(int i) {
- radix = i;
- }
-
- /**
* @param string
*/
public void setFormat(String string) {
@@ -424,14 +288,6 @@
this.tranformationInputParameter = b;
}
- public DatatypeRecordImpl getDatatype() {
- return this.datatype;
- }
-
- public void setDatatype(DatatypeRecordImpl datatype) {
- this.datatype = datatype;
- }
-
public String toString() {
StringBuffer sb = new StringBuffer(100);
sb.append(getClass().getSimpleName());
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSetRecordImpl.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSetRecordImpl.java 2009-07-10
20:48:29 UTC (rev 1119)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSetRecordImpl.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -53,29 +53,34 @@
* Retrieves a list of ColumnRecordImpls containing only id and position information
(used by System Tables)
*/
public List<ColumnRecordImpl> getColumnIdEntries() {
- if (columns != null) {
- final List<ColumnRecordImpl> entryRecords = new
ArrayList<ColumnRecordImpl>(columns.size());
- for (int i = 0, n = columns.size(); i < n; i++) {
- ColumnRecordImpl columnRecordImpl = columns.get(i);
- final int position = i+1;
- ColumnRecordImpl impl = new ColumnRecordImpl();
- entryRecords.add( impl );
- impl.setUUID(columnRecordImpl.getUUID());
- impl.setPosition(position);
- }
- return entryRecords;
- }
- final List<ColumnRecordImpl> entryRecords = new
ArrayList<ColumnRecordImpl>(columnIDs.size());
- for (int i = 0, n = columnIDs.size(); i < n; i++) {
- final String uuid = columnIDs.get(i);
- final int position = i+1;
+ int count = getColumnCount();
+ final List<ColumnRecordImpl> entryRecords = new
ArrayList<ColumnRecordImpl>(count);
+ for (int i = 0; i < count; i++) {
+ final String uuid = getUUID(i);
ColumnRecordImpl impl = new ColumnRecordImpl();
entryRecords.add( impl );
impl.setUUID(uuid);
- impl.setPosition(position);
+ impl.setPosition(i+1);
}
return entryRecords;
}
+
+ private int getColumnCount() {
+ if (columnIDs != null) {
+ return columnIDs.size();
+ }
+ if (columns != null) {
+ return columns.size();
+ }
+ return 0;
+ }
+
+ private String getUUID(int index) {
+ if (columnIDs != null) {
+ return columnIDs.get(index);
+ }
+ return columns.get(index).getUUID();
+ }
/**
* @see com.metamatrix.modeler.core.metadata.runtime.ColumnSetRecord#getType()
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ConnectorMetadata.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ConnectorMetadata.java 2009-07-10
20:48:29 UTC (rev 1119)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ConnectorMetadata.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
package org.teiid.connector.metadata.runtime;
import java.io.Serializable;
@@ -5,14 +27,35 @@
public interface ConnectorMetadata extends Serializable {
+ /**
+ * Get the model that this metadata represents. The model name is treated as
+ * a top level schema for all source metadata.
+ * @return
+ */
ModelRecordImpl getModel();
+ /**
+ * Get the tables defined for this model
+ * @return
+ */
Collection<TableRecordImpl> getTables();
+ /**
+ * Get the procedures defined for this model
+ * @return
+ */
Collection<ProcedureRecordImpl> getProcedures();
+ /**
+ * Get the annotations defined for this model
+ * @return
+ */
Collection<AnnotationRecordImpl> getAnnotations();
+ /**
+ * Get the extension properties defined for this model
+ * @return
+ */
Collection<PropertyRecordImpl> getProperties();
//costing
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java 2009-07-10
20:48:29 UTC (rev 1119)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -24,12 +24,16 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.teiid.connector.DataPlugin;
import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.TypeFacility;
+import org.teiid.connector.metadata.runtime.MetadataConstants.PARAMETER_TYPES;
import org.teiid.connector.metadata.runtime.MetadataConstants.RECORD_TYPE;
import com.metamatrix.core.id.UUIDFactory;
@@ -46,6 +50,8 @@
private Collection<AnnotationRecordImpl> annotations = new
ArrayList<AnnotationRecordImpl>();
private Collection<PropertyRecordImpl> properties = new
ArrayList<PropertyRecordImpl>();
+ private Set<String> uniqueNames = new HashSet<String>();
+
public MetadataFactory(String modelName, Map<String, DatatypeRecordImpl>
dataTypes) {
this.dataTypes = dataTypes;
model = new ModelRecordImpl();
@@ -56,6 +62,7 @@
setUUID(model);
}
+ @Override
public ModelRecordImpl getModel() {
return model;
}
@@ -82,19 +89,26 @@
private void setUUID(AbstractMetadataRecord record) {
record.setUUID(factory.create().toString());
}
-
- private static void setValuesUsingParent(String name,
- AbstractMetadataRecord parent, AbstractMetadataRecord child) {
+
+ private void setValuesUsingParent(String name,
+ AbstractMetadataRecord parent, AbstractMetadataRecord child) throws ConnectorException
{
child.setFullName(parent.getFullName() + "." + name); //$NON-NLS-1$
child.setParentUUID(parent.getUUID());
+ if (!uniqueNames.add(child.getRecordType() + "/" + child.getFullName())) {
//$NON-NLS-1$
+ throw new
ConnectorException(DataPlugin.Util.getString("MetadataFactory.duplicate_name",
child)); //$NON-NLS-1$
+ }
}
- public TableRecordImpl addTable(String name) {
+ /**
+ * Add a table with the given name to the model.
+ * @param name
+ * @return
+ * @throws ConnectorException
+ */
+ public TableRecordImpl addTable(String name) throws ConnectorException {
TableRecordImpl table = new TableRecordImpl();
setValuesUsingParent(name, model, table);
table.setRecordType(RECORD_TYPE.TABLE);
- table.setModel(model);
- table.setTableType(MetadataConstants.TABLE_TYPES.TABLE_TYPE);
table.setColumns(new LinkedList<ColumnRecordImpl>());
table.setAccessPatterns(new LinkedList<ColumnSetRecordImpl>());
table.setIndexes(new LinkedList<ColumnSetRecordImpl>());
@@ -106,34 +120,51 @@
return table;
}
- public ColumnRecordImpl addColumn(String name, String type, TableRecordImpl table)
throws ConnectorException {
+ /**
+ * Adds a column to the table with the given name and type.
+ * @param name
+ * @param type should be one of {@link TypeFacility.RUNTIME_NAMES}
+ * @param table
+ * @return
+ * @throws ConnectorException
+ */
+ public ColumnRecordImpl addColumn(String name, String type, ColumnSetRecordImpl table)
throws ConnectorException {
ColumnRecordImpl column = new ColumnRecordImpl();
setValuesUsingParent(name, table, column);
column.setRecordType(RECORD_TYPE.COLUMN);
table.getColumns().add(column);
- column.setPosition(table.getColumns().size());
- column.setNullValues(-1);
- column.setDistinctValues(-1);
+ column.setPosition(table.getColumns().size()); //1 based indexing
+ DatatypeRecordImpl datatype = setColumnType(type, column);
+ column.setCaseSensitive(datatype.isCaseSensitive());
+ column.setAutoIncrementable(datatype.isAutoIncrement());
+ column.setSigned(datatype.isSigned());
+ column.setExtensionProperties(new LinkedList<PropertyRecordImpl>());
+ setUUID(column);
+ return column;
+ }
+
+ private DatatypeRecordImpl setColumnType(String type,
+ BaseColumn column) throws ConnectorException {
DatatypeRecordImpl datatype = dataTypes.get(type);
if (datatype == null) {
throw new
ConnectorException(DataPlugin.Util.getString("MetadataFactory.unknown_datatype",
type)); //$NON-NLS-1$
}
column.setDatatype(datatype);
- column.setCaseSensitive(datatype.isCaseSensitive());
- column.setAutoIncrementable(datatype.isAutoIncrement());
column.setDatatypeUUID(datatype.getUUID());
column.setLength(datatype.getLength());
column.setNullType(datatype.getNullType());
column.setPrecision(datatype.getPrecisionLength());
column.setRadix(datatype.getRadix());
column.setRuntimeType(datatype.getRuntimeTypeName());
- column.setSelectable(true);
- column.setSigned(datatype.isSigned());
- column.setExtensionProperties(new LinkedList<PropertyRecordImpl>());
- setUUID(column);
- return column;
+ return datatype;
}
+ /**
+ * Add an annotation of description to a record. Only one annotation should be added
per record.
+ * @param annotation
+ * @param record
+ * @return
+ */
public AnnotationRecordImpl addAnnotation(String annotation, AbstractMetadataRecord
record) {
AnnotationRecordImpl annotationRecordImpl = new AnnotationRecordImpl();
annotationRecordImpl.setRecordType(RECORD_TYPE.ANNOTATION);
@@ -145,24 +176,41 @@
return annotationRecordImpl;
}
+ /**
+ * Adds a primary key to the given table. The column names should be in key order.
+ * @param name
+ * @param columnNames
+ * @param table
+ * @return
+ * @throws ConnectorException
+ */
public ColumnSetRecordImpl addPrimaryKey(String name, List<String> columnNames,
TableRecordImpl table) throws ConnectorException {
ColumnSetRecordImpl primaryKey = new
ColumnSetRecordImpl(MetadataConstants.KEY_TYPES.PRIMARY_KEY);
primaryKey.setColumns(new ArrayList<ColumnRecordImpl>(columnNames.size()));
primaryKey.setRecordType(RECORD_TYPE.PRIMARY_KEY);
+ setValuesUsingParent(name, table, primaryKey);
setUUID(primaryKey);
- setValuesUsingParent(name, table, primaryKey);
assignColumns(columnNames, table, primaryKey);
table.setPrimaryKey(primaryKey);
table.setPrimaryKeyID(primaryKey.getUUID());
return primaryKey;
}
+ /**
+ * Adds an index or unique key constraint to the given table.
+ * @param name
+ * @param nonUnique true indicates that an index is being added.
+ * @param columnNames
+ * @param table
+ * @return
+ * @throws ConnectorException
+ */
public ColumnSetRecordImpl addIndex(String name, boolean nonUnique, List<String>
columnNames, TableRecordImpl table) throws ConnectorException {
ColumnSetRecordImpl index = new
ColumnSetRecordImpl(nonUnique?MetadataConstants.KEY_TYPES.INDEX:MetadataConstants.KEY_TYPES.UNIQUE_KEY);
index.setColumns(new ArrayList<ColumnRecordImpl>(columnNames.size()));
index.setRecordType(nonUnique?MetadataConstants.RECORD_TYPE.INDEX:MetadataConstants.RECORD_TYPE.UNIQUE_KEY);
+ setValuesUsingParent(name, table, index);
setUUID(index);
- setValuesUsingParent(name, table, index);
assignColumns(columnNames, table, index);
if (nonUnique) {
table.getIndexes().add(index);
@@ -172,12 +220,21 @@
return index;
}
+ /**
+ * Adds a foreign key to the given table. The column names should be in key order.
+ * @param name
+ * @param columnNames
+ * @param pkTable
+ * @param table
+ * @return
+ * @throws ConnectorException
+ */
public ForeignKeyRecordImpl addForiegnKey(String name, List<String> columnNames,
TableRecordImpl pkTable, TableRecordImpl table) throws ConnectorException {
ForeignKeyRecordImpl foreignKey = new ForeignKeyRecordImpl();
foreignKey.setColumns(new ArrayList<ColumnRecordImpl>(columnNames.size()));
foreignKey.setRecordType(RECORD_TYPE.FOREIGN_KEY);
+ setValuesUsingParent(name, table, foreignKey);
setUUID(foreignKey);
- setValuesUsingParent(name, table, foreignKey);
foreignKey.setPrimaryKey(pkTable.getPrimaryKey());
foreignKey.setUniqueKeyID(pkTable.getPrimaryKeyID());
assignColumns(columnNames, table, foreignKey);
@@ -185,11 +242,19 @@
return foreignKey;
}
- public PropertyRecordImpl addExtensionProperty(String name, String value,
AbstractMetadataRecord record) {
+ /**
+ * Adds an extension property to the given record.
+ * @param name
+ * @param value
+ * @param record
+ * @return
+ * @throws ConnectorException
+ */
+ public PropertyRecordImpl addExtensionProperty(String name, String value,
AbstractMetadataRecord record) throws ConnectorException {
PropertyRecordImpl property = new PropertyRecordImpl();
property.setRecordType(RECORD_TYPE.PROPERTY);
+ setValuesUsingParent(name, record, property);
setUUID(property);
- setValuesUsingParent(name, record, property);
property.setPropertyName(name);
property.setPropertyValue(value);
properties.add(property);
@@ -199,6 +264,63 @@
record.getExtensionProperties().add(property);
return property;
}
+
+ /**
+ * Add a procedure with the given name to the model.
+ * @param name
+ * @return
+ * @throws ConnectorException
+ */
+ public ProcedureRecordImpl addProcedure(String name) throws ConnectorException {
+ ProcedureRecordImpl procedure = new ProcedureRecordImpl();
+ procedure.setRecordType(RECORD_TYPE.CALLABLE);
+ setValuesUsingParent(name, this.model, procedure);
+ setUUID(procedure);
+ procedure.setParameters(new LinkedList<ProcedureParameterRecordImpl>());
+ this.procedures.add(procedure);
+ return procedure;
+ }
+
+ /**
+ *
+ * @param name
+ * @param type should be one of {@link PARAMETER_TYPES}
+ * @param parameterType should be one of {@link TypeFacility.RUNTIME_NAMES}
+ * @param procedure
+ * @return
+ * @throws ConnectorException
+ */
+ public ProcedureParameterRecordImpl addProcedureParameter(String name, String type,
short parameterType, ProcedureRecordImpl procedure) throws ConnectorException {
+ ProcedureParameterRecordImpl param = new ProcedureParameterRecordImpl();
+ param.setRecordType(RECORD_TYPE.CALLABLE_PARAMETER);
+ setValuesUsingParent(name, procedure, param);
+ setUUID(param);
+ param.setType(parameterType);
+ setColumnType(type, param);
+ procedure.getParameters().add(param);
+ param.setPosition(procedure.getParameters().size()); //1 based indexing
+ return param;
+ }
+
+ /**
+ *
+ * @param name
+ * @param type should be one of {@link TypeFacility.RUNTIME_NAMES}
+ * @param procedure
+ * @return
+ * @throws ConnectorException
+ */
+ public ColumnRecordImpl addProcedureResultSetColumn(String name, String type,
ProcedureRecordImpl procedure) throws ConnectorException {
+ if (procedure.getResultSet() == null) {
+ ColumnSetRecordImpl resultSet = new ColumnSetRecordImpl((short)-1);
+ resultSet.setRecordType(RECORD_TYPE.RESULT_SET);
+ setValuesUsingParent("RESULT_SET", procedure, resultSet); //$NON-NLS-1$
+ setUUID(resultSet);
+ procedure.setResultSet(resultSet);
+ procedure.setResultSetID(resultSet.getUUID());
+ }
+ return addColumn(name, type, procedure.getResultSet());
+ }
private void assignColumns(List<String> columnNames, TableRecordImpl table,
ColumnSetRecordImpl columns) throws ConnectorException {
@@ -212,7 +334,7 @@
}
}
if (!match) {
- throw new ConnectorException("No column found with name " + columnName);
+ throw new
ConnectorException(DataPlugin.Util.getString("MetadataFactory.no_column_found",
columnName)); //$NON-NLS-1$
}
}
}
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameterRecordImpl.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameterRecordImpl.java 2009-07-10
20:48:29 UTC (rev 1119)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameterRecordImpl.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -25,180 +25,25 @@
/**
* ProcedureParameterRecordImpl
*/
-public class ProcedureParameterRecordImpl extends AbstractMetadataRecord {
+public class ProcedureParameterRecordImpl extends BaseColumn {
- private String datatypeUUID;
- private String runtimeType;
- private Object defaultValue;
- private int type;
- private int length;
- private int scale;
- private int radix;
- private int precision;
- private int nullType;
- private int position;
- private boolean optional;
- private DatatypeRecordImpl datatype;
-
- /*
- * @see
com.metamatrix.modeler.core.metadata.runtime.ProcedureParameterRecord#getDefaultValue()
- */
- public Object getDefaultValue() {
- return defaultValue;
- }
-
- /*
- * @see
com.metamatrix.modeler.core.metadata.runtime.ProcedureParameterRecord#getType()
- */
- public short getType() {
- return (short)type;
- }
-
- /*
- * @see
com.metamatrix.modeler.core.metadata.runtime.ProcedureParameterRecord#getDatatypeUUID()
- */
- public String getDatatypeUUID() {
- return datatypeUUID;
- }
-
- /*
- * @see
com.metamatrix.modeler.core.metadata.runtime.ProcedureParameterRecord#getRuntimeType()
- */
- public String getRuntimeType() {
- return runtimeType;
- }
-
- /**
- * @return
- */
- public int getLength() {
- return length;
- }
-
- /**
- * @return
- */
- public int getPrecision() {
- return precision;
- }
-
- /**
- * @return
- */
- public int getScale() {
- return scale;
- }
-
- /**
- * @return
- */
- public int getRadix() {
- return radix;
- }
-
- /**
- * @return
- */
- public int getPosition() {
- return position;
- }
-
- /**
- * @return
- */
- public int getNullType() {
- return nullType;
- }
-
- /*
- * @see
com.metamatrix.modeler.core.metadata.runtime.ProcedureParameterRecord#isOptional()
- */
- public boolean isOptional() {
- return optional;
+ private short type;
+ private boolean optional;
+
+ public void setType(short type) {
+ this.type = type;
}
-
- /**
- * @param i
- */
- public void setLength(int i) {
- length = i;
+
+ public short getType() {
+ return type;
}
-
- /**
- * @param i
- */
- public void setPrecision(int i) {
- precision = i;
+
+ public void setOptional(boolean optional) {
+ this.optional = optional;
}
-
- /**
- * @param i
- */
- public void setScale(int i) {
- scale = i;
+
+ public boolean isOptional() {
+ return optional;
}
-
- /**
- * @param i
- */
- public void setRadix(int i) {
- radix = i;
- }
-
- /**
- * @param i
- */
- public void setNullType(int i) {
- nullType = i;
- }
-
- /**
- * @param i
- */
- public void setPosition(int i) {
- position = i;
- }
-
- /**
- * @param string
- */
- public void setRuntimeType(String string) {
- runtimeType = string;
- }
- /**
- * @param string
- */
- public void setDatatypeUUID(String string) {
- datatypeUUID = string;
- }
-
- /**
- * @param object
- */
- public void setDefaultValue(Object object) {
- defaultValue = object;
- }
-
- /**
- * @param i
- */
- public void setType(int i) {
- type = i;
- }
-
- /**
- * @param b
- */
- public void setOptional(boolean b) {
- optional = b;
- }
- public DatatypeRecordImpl getDatatype() {
- return datatype;
- }
-
- public void setDatatype(DatatypeRecordImpl datatype) {
- this.datatype = datatype;
- }
-
}
\ No newline at end of file
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureRecordImpl.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureRecordImpl.java 2009-07-10
20:48:29 UTC (rev 1119)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureRecordImpl.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -30,16 +30,19 @@
*/
public class ProcedureRecordImpl extends AbstractMetadataRecord {
- private List parameterIDs;
+ private List<String> parameterIDs;
private boolean isFunction;
private boolean isVirtual;
private String resultSetID;
- private int updateCount;
+ private int updateCount = 1;
+ private List<ProcedureParameterRecordImpl> parameters;
+ private ColumnSetRecordImpl resultSet;
+ private String queryPlan;
/*
* @see
com.metamatrix.modeler.core.metadata.runtime.ProcedureRecord#getParameterIDs()
*/
- public List getParameterIDs() {
+ public List<String> getParameterIDs() {
return parameterIDs;
}
@@ -78,11 +81,27 @@
public int getUpdateCount() {
return this.updateCount;
}
+
+ public List<ProcedureParameterRecordImpl> getParameters() {
+ return parameters;
+ }
+ public void setParameters(List<ProcedureParameterRecordImpl> parameters) {
+ this.parameters = parameters;
+ }
+
+ public String getQueryPlan() {
+ return queryPlan;
+ }
+
+ public void setQueryPlan(String queryPlan) {
+ this.queryPlan = queryPlan;
+ }
+
/**
* @param list
*/
- public void setParameterIDs(List list) {
+ public void setParameterIDs(List<String> list) {
parameterIDs = list;
}
@@ -121,4 +140,12 @@
return MetadataConstants.PROCEDURE_TYPES.STORED_PROCEDURE;
}
+ public void setResultSet(ColumnSetRecordImpl resultSet) {
+ this.resultSet = resultSet;
+ }
+
+ public ColumnSetRecordImpl getResultSet() {
+ return resultSet;
+ }
+
}
\ No newline at end of file
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/TableRecordImpl.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/TableRecordImpl.java 2009-07-10
20:48:29 UTC (rev 1119)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/TableRecordImpl.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -38,7 +38,6 @@
private boolean isSystem;
private boolean isMaterialized;
private boolean supportsUpdate;
- private ModelRecordImpl model;
private String insertPlan;
private String updatePlan;
private String deletePlan;
@@ -201,14 +200,6 @@
this.materializedTableID = materializedTableID;
}
- public ModelRecordImpl getModel() {
- return this.model;
- }
-
- public void setModel(ModelRecordImpl model) {
- this.model = model;
- }
-
public String getInsertPlan() {
return insertPlan;
}
Modified: trunk/connector-api/src/main/resources/org/teiid/connector/i18n.properties
===================================================================
--- trunk/connector-api/src/main/resources/org/teiid/connector/i18n.properties 2009-07-10
20:48:29 UTC (rev 1119)
+++ trunk/connector-api/src/main/resources/org/teiid/connector/i18n.properties 2009-07-11
15:27:48 UTC (rev 1120)
@@ -63,4 +63,6 @@
UserIdentityFactory.extraction_error=Unable to extract credentials from command payload
or trusted session payload for per-user connection.
UserIdentityFactory.missing_credentials=Payload missing credentials for {0}
-MetadataFactory.unknown_datatype=Unknown datatype {0}
\ No newline at end of file
+MetadataFactory.unknown_datatype=Unknown datatype {0}
+MetadataFactory.no_column_found=No column found with name {0}
+MetadataFactory.duplicate_name="Non-uniquely named record detected
''{0}''
\ No newline at end of file
Modified:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java
===================================================================
---
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java 2009-07-10
20:48:29 UTC (rev 1119)
+++
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -34,12 +34,21 @@
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.TypeFacility;
import org.teiid.connector.metadata.runtime.AbstractMetadataRecord;
+import org.teiid.connector.metadata.runtime.BaseColumn;
import org.teiid.connector.metadata.runtime.ColumnRecordImpl;
import org.teiid.connector.metadata.runtime.MetadataFactory;
+import org.teiid.connector.metadata.runtime.ProcedureRecordImpl;
import org.teiid.connector.metadata.runtime.TableRecordImpl;
+import org.teiid.connector.metadata.runtime.MetadataConstants.PARAMETER_TYPES;
+/**
+ * Reads from {@link DatabaseMetaData} and creates metadata through the {@link
MetadataFactory}.
+ */
public class JDBCMetdataProcessor {
+ /**
+ * A holder for table records that keeps track of catalog and schema information.
+ */
private static class TableInfo {
private String catalog;
private String schema;
@@ -68,9 +77,81 @@
public void getConnectorMetadata(Connection conn, MetadataFactory metadataFactory)
throws SQLException, ConnectorException {
+ DatabaseMetaData metadata = conn.getMetaData();
- //- retrieve tables
- DatabaseMetaData metadata = conn.getMetaData();
+ Map<String, TableInfo> tableMap = getTables(metadataFactory, metadata);
+
+ if (importKeys) {
+ getPrimaryKeys(metadataFactory, metadata, tableMap);
+
+ getForeignKeys(metadataFactory, metadata, tableMap);
+ }
+
+ if (importIndexes) {
+ getIndexes(metadataFactory, metadata, tableMap);
+ }
+
+ if (importProcedures) {
+ getProcedures(metadataFactory, metadata);
+ }
+ }
+
+ private void getProcedures(MetadataFactory metadataFactory,
+ DatabaseMetaData metadata) throws SQLException, ConnectorException {
+ ResultSet procedures = metadata.getProcedures(catalog, schemaPattern,
procedureNamePattern);
+ while (procedures.next()) {
+ String procedureCatalog = procedures.getString(1);
+ String procedureSchema = procedures.getString(2);
+ String procedureName = procedures.getString(3);
+ String fullProcedureName = getTableName(procedureCatalog, procedureSchema,
procedureName);
+ ProcedureRecordImpl procedure =
metadataFactory.addProcedure(useFullSchemaName?fullProcedureName:procedureName);
+ procedure.setNameInSource(fullProcedureName);
+ ResultSet columns = metadata.getProcedureColumns(catalog, procedureSchema,
procedureName, null);
+ while (columns.next()) {
+ String columnName = columns.getString(4);
+ short columnType = columns.getShort(5);
+ int sqlType = columns.getInt(6);
+ if (columnType == DatabaseMetaData.procedureColumnUnknown) {
+ continue; //there's a good chance this won't work
+ }
+ BaseColumn record = null;
+ if (columnType == DatabaseMetaData.procedureColumnResult) {
+ ColumnRecordImpl column = metadataFactory.addProcedureResultSetColumn(columnName,
TypeFacility.getDataTypeNameFromSQLType(sqlType), procedure);
+ record = column;
+ column.setNativeType(columns.getString(7));
+ } else {
+ record = metadataFactory.addProcedureParameter(columnName,
TypeFacility.getDataTypeNameFromSQLType(sqlType), getParameterType(columnType),
procedure);
+ }
+ record.setPrecision(columns.getInt(8));
+ record.setLength(columns.getInt(9));
+ record.setScale(columns.getInt(10));
+ record.setRadix(columns.getInt(11));
+ record.setNullType(columns.getShort(12));
+ String remarks = columns.getString(13);
+ if (remarks != null) {
+ metadataFactory.addAnnotation(remarks, record);
+ }
+ }
+ }
+ procedures.close();
+ }
+
+ private static short getParameterType(short type) {
+ switch (type) {
+ case DatabaseMetaData.procedureColumnIn:
+ return PARAMETER_TYPES.IN_PARM;
+ case DatabaseMetaData.procedureColumnInOut:
+ return PARAMETER_TYPES.INOUT_PARM;
+ case DatabaseMetaData.procedureColumnOut:
+ return PARAMETER_TYPES.OUT_PARM;
+ case DatabaseMetaData.procedureColumnReturn:
+ return PARAMETER_TYPES.RETURN_VALUE;
+ }
+ throw new AssertionError();
+ }
+
+ private Map<String, TableInfo> getTables(MetadataFactory metadataFactory,
+ DatabaseMetaData metadata) throws SQLException, ConnectorException {
ResultSet tables = metadata.getTables(catalog, schemaPattern, tableNamePattern,
tableTypes);
Map<String, TableInfo> tableMap = new HashMap<String, TableInfo>();
while (tables.next()) {
@@ -90,22 +171,7 @@
tables.close();
getColumns(metadataFactory, metadata, tableMap);
-
- if (importKeys) {
- getPrimaryKeys(metadataFactory, metadata, tableMap);
-
- getForeignKeys(metadataFactory, metadata, tableMap);
- }
-
- if (importIndexes) {
- getIndexes(metadataFactory, metadata, tableMap);
- }
-
- if (importProcedures) {
- /*ResultSet procedures = metadata.getProcedures(catalog, schemaPattern,
procedureNamePattern);
-
- procedures.close();*/
- }
+ return tableMap;
}
private void getColumns(MetadataFactory metadataFactory,
@@ -128,6 +194,7 @@
column.setNativeType(columns.getString(6));
column.setRadix(columns.getInt(10));
column.setNullType(columns.getInt(11));
+ column.setUpdatable(true);
String remarks = columns.getString(12);
if (remarks != null) {
metadataFactory.addAnnotation(remarks, column);
@@ -165,7 +232,7 @@
}
}
- private static void getForeignKeys(MetadataFactory metadataFactory,
+ private void getForeignKeys(MetadataFactory metadataFactory,
DatabaseMetaData metadata, Map<String, TableInfo> tableMap) throws SQLException,
ConnectorException {
for (TableInfo tableInfo : tableMap.values()) {
ResultSet fks = metadata.getImportedKeys(tableInfo.catalog, tableInfo.schema,
tableInfo.name);
Modified: trunk/engine/src/main/java/com/metamatrix/query/metadata/MetadataStore.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/metadata/MetadataStore.java 2009-07-10
20:48:29 UTC (rev 1119)
+++ trunk/engine/src/main/java/com/metamatrix/query/metadata/MetadataStore.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -26,7 +26,8 @@
import org.teiid.connector.metadata.runtime.AbstractMetadataRecord;
import org.teiid.connector.metadata.runtime.ColumnRecordImpl;
-import org.teiid.connector.metadata.runtime.DatatypeRecordImpl;
+import org.teiid.connector.metadata.runtime.ModelRecordImpl;
+import org.teiid.connector.metadata.runtime.ProcedureRecordImpl;
import org.teiid.connector.metadata.runtime.PropertyRecordImpl;
import org.teiid.connector.metadata.runtime.TableRecordImpl;
@@ -35,17 +36,30 @@
import com.metamatrix.core.MetaMatrixCoreException;
public interface MetadataStore {
+
+ ModelRecordImpl getModel(String fullName) throws QueryMetadataException,
MetaMatrixComponentException;
TableRecordImpl findGroup(String fullName) throws QueryMetadataException,
MetaMatrixComponentException;
+ /**
+ * Returns the fully qualified names of groups matching the given partial name.
+ *
+ * @param partialGroupName expected to be in lowercase
+ * @return
+ * @throws MetaMatrixComponentException
+ * @throws QueryMetadataException
+ */
Collection<String> getGroupsForPartialName(final String partialGroupName)
throws MetaMatrixComponentException, QueryMetadataException;
- StoredProcedureInfo getStoredProcedureInfoForProcedure(final String
fullyQualifiedProcedureName)
+ ProcedureRecordImpl getStoredProcedure(final String fullyQualifiedProcedureName)
throws MetaMatrixComponentException, QueryMetadataException;
Collection<PropertyRecordImpl> getExtensionProperties(AbstractMetadataRecord
record) throws MetaMatrixComponentException;
+ /**
+ * Get the set of model names known to this store.
+ */
Collection<String> getModelNames();
/**
Modified: trunk/metadata/src/main/java/org/teiid/metadata/CompositeMetadataStore.java
===================================================================
--- trunk/metadata/src/main/java/org/teiid/metadata/CompositeMetadataStore.java 2009-07-10
20:48:29 UTC (rev 1119)
+++ trunk/metadata/src/main/java/org/teiid/metadata/CompositeMetadataStore.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -30,6 +30,8 @@
import org.teiid.connector.metadata.runtime.AbstractMetadataRecord;
import org.teiid.connector.metadata.runtime.ColumnRecordImpl;
+import org.teiid.connector.metadata.runtime.ModelRecordImpl;
+import org.teiid.connector.metadata.runtime.ProcedureRecordImpl;
import org.teiid.connector.metadata.runtime.PropertyRecordImpl;
import org.teiid.connector.metadata.runtime.TableRecordImpl;
@@ -39,7 +41,6 @@
import com.metamatrix.core.util.StringUtil;
import com.metamatrix.metadata.runtime.api.MetadataSource;
import com.metamatrix.query.metadata.MetadataStore;
-import com.metamatrix.query.metadata.StoredProcedureInfo;
public class CompositeMetadataStore implements MetadataStore {
@@ -64,6 +65,12 @@
}
@Override
+ public ModelRecordImpl getModel(String fullName)
+ throws QueryMetadataException, MetaMatrixComponentException {
+ return getMetadataStore(fullName).getModel(fullName);
+ }
+
+ @Override
public ColumnRecordImpl findElement(String fullName)
throws QueryMetadataException, MetaMatrixComponentException {
List<String> tokens = StringUtil.getTokens(fullName,
TransformationMetadata.DELIMITER_STRING);
@@ -100,14 +107,14 @@
}
@Override
- public StoredProcedureInfo getStoredProcedureInfoForProcedure(
+ public ProcedureRecordImpl getStoredProcedure(
String fullyQualifiedProcedureName)
throws MetaMatrixComponentException, QueryMetadataException {
List<String> tokens = StringUtil.getTokens(fullyQualifiedProcedureName,
TransformationMetadata.DELIMITER_STRING);
if (tokens.size() < 2) {
throw new
QueryMetadataException(fullyQualifiedProcedureName+TransformationMetadata.NOT_EXISTS_MESSAGE);
}
- return
getMetadataStore(tokens.get(0)).getStoredProcedureInfoForProcedure(fullyQualifiedProcedureName);
+ return
getMetadataStore(tokens.get(0)).getStoredProcedure(fullyQualifiedProcedureName);
}
@Override
Modified: trunk/metadata/src/main/java/org/teiid/metadata/ConnectorMetadataStore.java
===================================================================
--- trunk/metadata/src/main/java/org/teiid/metadata/ConnectorMetadataStore.java 2009-07-10
20:48:29 UTC (rev 1119)
+++ trunk/metadata/src/main/java/org/teiid/metadata/ConnectorMetadataStore.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -34,6 +34,9 @@
import org.teiid.connector.metadata.runtime.ColumnSetRecordImpl;
import org.teiid.connector.metadata.runtime.ConnectorMetadata;
import org.teiid.connector.metadata.runtime.MetadataConstants;
+import org.teiid.connector.metadata.runtime.ModelRecordImpl;
+import org.teiid.connector.metadata.runtime.ProcedureParameterRecordImpl;
+import org.teiid.connector.metadata.runtime.ProcedureRecordImpl;
import org.teiid.connector.metadata.runtime.PropertyRecordImpl;
import org.teiid.connector.metadata.runtime.TableRecordImpl;
import org.teiid.metadata.index.IndexConstants;
@@ -43,7 +46,6 @@
import com.metamatrix.core.MetaMatrixCoreException;
import com.metamatrix.dqp.service.DataService;
import com.metamatrix.query.metadata.MetadataStore;
-import com.metamatrix.query.metadata.StoredProcedureInfo;
import com.metamatrix.vdb.runtime.VDBKey;
public class ConnectorMetadataStore implements MetadataStore {
@@ -57,6 +59,13 @@
}
@Override
+ public ModelRecordImpl getModel(String fullName)
+ throws QueryMetadataException, MetaMatrixComponentException {
+ //there's no need to check the name, the CompositeMetadataStore will have already
done that
+ return metadata.getModel();
+ }
+
+ @Override
public ColumnRecordImpl findElement(String fullName)
throws QueryMetadataException, MetaMatrixComponentException {
throw new UnsupportedOperationException();
@@ -91,10 +100,15 @@
}
@Override
- public StoredProcedureInfo getStoredProcedureInfoForProcedure(
+ public ProcedureRecordImpl getStoredProcedure(
String fullyQualifiedProcedureName)
throws MetaMatrixComponentException, QueryMetadataException {
- return null;
+ for (ProcedureRecordImpl procedureRecordImpl : metadata.getProcedures()) {
+ if (procedureRecordImpl.getFullName().equalsIgnoreCase(fullyQualifiedProcedureName))
{
+ return procedureRecordImpl;
+ }
+ }
+ throw new
QueryMetadataException(fullyQualifiedProcedureName+TransformationMetadata.NOT_EXISTS_MESSAGE);
}
@Override
@@ -115,12 +129,22 @@
switch (recordType) {
case MetadataConstants.RECORD_TYPE.CALLABLE:
return metadata.getProcedures();
- case MetadataConstants.RECORD_TYPE.CALLABLE_PARAMETER:
- //TODO
- return Collections.emptyList();
- case MetadataConstants.RECORD_TYPE.RESULT_SET:
- //TODO
- return Collections.emptyList();
+ case MetadataConstants.RECORD_TYPE.CALLABLE_PARAMETER: {
+ Collection<ProcedureParameterRecordImpl> results = new
ArrayList<ProcedureParameterRecordImpl>();
+ for (ProcedureRecordImpl procedure : metadata.getProcedures()) {
+ results.addAll(procedure.getParameters());
+ }
+ return results;
+ }
+ case MetadataConstants.RECORD_TYPE.RESULT_SET: {
+ Collection<ColumnSetRecordImpl> results = new
ArrayList<ColumnSetRecordImpl>();
+ for (ProcedureRecordImpl procedure : metadata.getProcedures()) {
+ if (procedure.getResultSet() != null) {
+ results.add(procedure.getResultSet());
+ }
+ }
+ return results;
+ }
case MetadataConstants.RECORD_TYPE.ACCESS_PATTERN: {
Collection<ColumnSetRecordImpl> results = new
ArrayList<ColumnSetRecordImpl>();
for (TableRecordImpl table : metadata.getTables()) {
Modified: trunk/metadata/src/main/java/org/teiid/metadata/TransformationMetadata.java
===================================================================
--- trunk/metadata/src/main/java/org/teiid/metadata/TransformationMetadata.java 2009-07-10
20:48:29 UTC (rev 1119)
+++ trunk/metadata/src/main/java/org/teiid/metadata/TransformationMetadata.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -51,6 +51,7 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.query.QueryMetadataException;
+import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.core.util.ArgCheck;
import com.metamatrix.core.util.LRUCache;
import com.metamatrix.core.util.StringUtil;
@@ -63,6 +64,7 @@
import com.metamatrix.query.metadata.BasicQueryMetadata;
import com.metamatrix.query.metadata.StoredProcedureInfo;
import com.metamatrix.query.metadata.SupportConstants;
+import com.metamatrix.query.sql.lang.SPParameter;
/**
* Modelers implementation of QueryMetadataInterface that reads columns, groups, models
etc.
@@ -82,10 +84,9 @@
public static final char DELIMITER_CHAR = IndexConstants.NAME_DELIM_CHAR;
public static final String DELIMITER_STRING = StringUtil.Constants.EMPTY_STRING +
IndexConstants.NAME_DELIM_CHAR;
- // error message cached to avaid i18n lookup each time
+ // error message cached to avoid i18n lookup each time
public static String NOT_EXISTS_MESSAGE =
StringUtil.Constants.SPACE+RuntimeMetadataPlugin.Util.getString("TransformationMetadata.does_not_exist._1");
//$NON-NLS-1$
- // context object all the info needed for metadata lookup
private final CompositeMetadataStore store;
/*
@@ -94,7 +95,8 @@
private final Map<String, Object> metadataCache =
Collections.synchronizedMap(new LRUCache<String, Object>(500));
private final Map<String, TableRecordImpl> groupCache =
Collections.synchronizedMap(new LRUCache<String, TableRecordImpl>(2000));
private final Map<String, StoredProcedureInfo> procedureCache =
Collections.synchronizedMap(new LRUCache<String, StoredProcedureInfo>(200));
- private final Map<String, String> partialNameToFullNameCache =
Collections.synchronizedMap(new LRUCache<String, String>(100));
+ private final Map<String, String> partialNameToFullNameCache =
Collections.synchronizedMap(new LRUCache<String, String>(1000));
+ private final Map<String, ModelRecordImpl> modelCache =
Collections.synchronizedMap(new LRUCache<String, ModelRecordImpl>(100));
/**
* TransformationMetadata constructor
@@ -160,11 +162,25 @@
* @see
com.metamatrix.query.metadata.QueryMetadataInterface#getModelID(java.lang.Object)
*/
public Object getModelID(final Object groupOrElementID) throws
MetaMatrixComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(TableRecordImpl.class, groupOrElementID);
+ if (!(groupOrElementID instanceof TableRecordImpl) && !(groupOrElementID
instanceof ColumnRecordImpl)) {
+ throw createInvalidRecordTypeException(groupOrElementID);
+ }
- return ((TableRecordImpl)groupOrElementID).getModel();
+ String modelName = ((AbstractMetadataRecord)groupOrElementID).getModelName();
+ return getModel(modelName);
}
+ private Object getModel(String modelName) throws QueryMetadataException,
+ MetaMatrixComponentException {
+ modelName = modelName.toUpperCase();
+ ModelRecordImpl model = modelCache.get(modelName);
+ if (model == null) {
+ model = getMetadataStore().getModel(modelName);
+ modelCache.put(modelName, model);
+ }
+ return model;
+ }
+
/* (non-Javadoc)
* @see
com.metamatrix.query.metadata.QueryMetadataInterface#getFullName(java.lang.Object)
*/
@@ -249,14 +265,83 @@
throws MetaMatrixComponentException, QueryMetadataException {
ArgCheck.isNotEmpty(fullyQualifiedProcedureName);
String upperGroupName = fullyQualifiedProcedureName.toUpperCase();
- StoredProcedureInfo result = this.procedureCache.get(upperGroupName);
+ StoredProcedureInfo procInfo = this.procedureCache.get(upperGroupName);
- if (result == null) {
- result =
getMetadataStore().getStoredProcedureInfoForProcedure(fullyQualifiedProcedureName);
- this.procedureCache.put(upperGroupName, result);
+ if (procInfo != null) {
+ return procInfo;
}
- return result;
+
+ ProcedureRecordImpl procRecord =
getMetadataStore().getStoredProcedure(fullyQualifiedProcedureName);
+
+ String procedureFullName = procRecord.getFullName();
+
+ // create the storedProcedure info object that would hold procedure's
metadata
+ procInfo = new StoredProcedureInfo();
+ procInfo.setProcedureCallableName(procRecord.getName());
+ procInfo.setProcedureID(procRecord);
+
+ // modelID for the procedure
+ procInfo.setModelID(getModel(procRecord.getModelName()));
+
+ // get the parameter metadata info
+ for (ProcedureParameterRecordImpl paramRecord : procRecord.getParameters()) {
+ String runtimeType = paramRecord.getRuntimeType();
+ int direction =
this.convertParamRecordTypeToStoredProcedureType(paramRecord.getType());
+ // create a parameter and add it to the procedure object
+ SPParameter spParam = new SPParameter(paramRecord.getPosition(), direction,
paramRecord.getFullName());
+ spParam.setMetadataID(paramRecord);
+ spParam.setClassType(DataTypeManager.getDataTypeClass(runtimeType));
+ procInfo.addParameter(spParam);
+ }
+
+ // if the procedure returns a resultSet, obtain resultSet metadata
+ if(procRecord.getResultSet() != null) {
+ ColumnSetRecordImpl resultRecord = procRecord.getResultSet();
+ // resultSet is the last parameter in the procedure
+ int lastParamIndex = procInfo.getParameters().size() + 1;
+ SPParameter param = new SPParameter(lastParamIndex, SPParameter.RESULT_SET,
resultRecord.getFullName());
+ param.setClassType(java.sql.ResultSet.class);
+ param.setMetadataID(resultRecord);
+
+ for (ColumnRecordImpl columnRecord : resultRecord.getColumns()) {
+ String colType = columnRecord.getRuntimeType();
+ param.addResultSetColumn(columnRecord.getFullName(),
DataTypeManager.getDataTypeClass(colType), columnRecord);
+ }
+
+ procInfo.addParameter(param);
+ }
+
+ // if this is a virtual procedure get the procedure plan
+ if(procRecord.isVirtual()) {
+ QueryNode queryNode = new QueryNode(procedureFullName,
procRecord.getQueryPlan());
+ procInfo.setQueryPlan(queryNode);
+ }
+
+ //subtract 1, to match up with the server
+ procInfo.setUpdateCount(procRecord.getUpdateCount() -1);
+
+ this.procedureCache.put(upperGroupName, procInfo);
+
+ return procInfo;
}
+
+ /**
+ * Method to convert the parameter type returned from a ProcedureParameterRecord
+ * to the parameter type expected by StoredProcedureInfo
+ * @param parameterType
+ * @return
+ */
+ private int convertParamRecordTypeToStoredProcedureType(final int parameterType) {
+ switch (parameterType) {
+ case MetadataConstants.PARAMETER_TYPES.IN_PARM : return SPParameter.IN;
+ case MetadataConstants.PARAMETER_TYPES.OUT_PARM : return SPParameter.OUT;
+ case MetadataConstants.PARAMETER_TYPES.INOUT_PARM : return
SPParameter.INOUT;
+ case MetadataConstants.PARAMETER_TYPES.RETURN_VALUE : return
SPParameter.RETURN_VALUE;
+ case MetadataConstants.PARAMETER_TYPES.RESULT_SET : return
SPParameter.RESULT_SET;
+ default :
+ return -1;
+ }
+ }
/* (non-Javadoc)
* @see
com.metamatrix.query.metadata.QueryMetadataInterface#getElementType(java.lang.Object)
Modified: trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataStore.java
===================================================================
---
trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataStore.java 2009-07-10
20:48:29 UTC (rev 1119)
+++
trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataStore.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -52,21 +52,21 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.query.QueryMetadataException;
-import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.core.MetaMatrixCoreException;
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.id.UUID;
import com.metamatrix.core.util.ArgCheck;
import com.metamatrix.core.util.StringUtil;
import com.metamatrix.metadata.runtime.api.MetadataSource;
-import com.metamatrix.query.mapping.relational.QueryNode;
import com.metamatrix.query.metadata.MetadataStore;
-import com.metamatrix.query.metadata.StoredProcedureInfo;
-import com.metamatrix.query.sql.lang.SPParameter;
+/**
+ * Loads MetadataRecords from index files.
+ * Only datatypes are directly cached.
+ */
public class IndexMetadataStore implements MetadataStore {
- // size of file being returned by content methods
- private Index[] indexes;
+
+ private Index[] indexes;
private Map<String, DatatypeRecordImpl> datatypeCache;
public IndexMetadataStore(MetadataSource source) throws IOException {
@@ -100,6 +100,10 @@
return result;
}
+ public ModelRecordImpl getModel(String name) throws QueryMetadataException,
MetaMatrixComponentException {
+ return (ModelRecordImpl)getRecordByType(name, MetadataConstants.RECORD_TYPE.MODEL);
+ }
+
@Override
public TableRecordImpl findGroup(String groupName) throws QueryMetadataException,
MetaMatrixComponentException {
TableRecordImpl tableRecord = (TableRecordImpl)getRecordByType(groupName,
MetadataConstants.RECORD_TYPE.TABLE);
@@ -131,7 +135,6 @@
loadColumnSetRecords(primaryKey, uuidColumnMap);
tableRecord.setPrimaryKey(primaryKey);
}
- tableRecord.setModel((ModelRecordImpl)getRecordByType(tableRecord.getModelName(),
MetadataConstants.RECORD_TYPE.MODEL));
if (tableRecord.isVirtual()) {
TransformationRecordImpl update =
(TransformationRecordImpl)getRecordByType(groupName,
MetadataConstants.RECORD_TYPE.UPDATE_TRANSFORM,false);
if (update != null) {
@@ -220,59 +223,27 @@
throw new
QueryMetadataException(RuntimeMetadataPlugin.Util.getString("TransformationMetadata.0",
entityName)); //$NON-NLS-1$
}
- /* (non-Javadoc)
- * @see
com.metamatrix.query.metadata.QueryMetadataInterface#getStoredProcedureInfoForProcedure(java.lang.String)
- */
- public StoredProcedureInfo getStoredProcedureInfoForProcedure(final String
fullyQualifiedProcedureName)
- throws MetaMatrixComponentException, QueryMetadataException {
+ @Override
+ public ProcedureRecordImpl getStoredProcedure(
+ String fullyQualifiedProcedureName)
+ throws MetaMatrixComponentException, QueryMetadataException {
+ ProcedureRecordImpl procedureRecord =
(ProcedureRecordImpl)getRecordByType(fullyQualifiedProcedureName,
MetadataConstants.RECORD_TYPE.CALLABLE);
- ProcedureRecordImpl procRecord = (ProcedureRecordImpl)
getRecordByType(fullyQualifiedProcedureName, MetadataConstants.RECORD_TYPE.CALLABLE);
-
- String procedureFullName = procRecord.getFullName();
-
- // create the storedProcedure info object that would hold procedure's
metadata
- StoredProcedureInfo procInfo = new StoredProcedureInfo();
- procInfo.setProcedureCallableName(procRecord.getName());
- procInfo.setProcedureID(procRecord);
-
- // modelID for the procedure
- AbstractMetadataRecord modelRecord = getRecordByType(procRecord.getModelName(),
MetadataConstants.RECORD_TYPE.MODEL);
- procInfo.setModelID(modelRecord);
-
+ procedureRecord.setParameters(new
ArrayList<ProcedureParameterRecordImpl>(procedureRecord.getParameterIDs().size()));
+
// get the parameter metadata info
- for(Iterator paramIter =
procRecord.getParameterIDs().iterator();paramIter.hasNext();) {
- String paramID = (String) paramIter.next();
+ for (String paramID : procedureRecord.getParameterIDs()) {
ProcedureParameterRecordImpl paramRecord = (ProcedureParameterRecordImpl)
this.getRecordByType(paramID, MetadataConstants.RECORD_TYPE.CALLABLE_PARAMETER);
- String runtimeType = paramRecord.getRuntimeType();
- int direction =
this.convertParamRecordTypeToStoredProcedureType(paramRecord.getType());
- // create a parameter and add it to the procedure object
- SPParameter spParam = new SPParameter(paramRecord.getPosition(), direction,
paramRecord.getFullName());
- spParam.setMetadataID(paramRecord);
- if (paramRecord.getDatatypeUUID() != null) {
-
paramRecord.setDatatype((DatatypeRecordImpl)getRecordByType(paramRecord.getDatatypeUUID(),
MetadataConstants.RECORD_TYPE.DATATYPE));
- }
- spParam.setClassType(DataTypeManager.getDataTypeClass(runtimeType));
- procInfo.addParameter(spParam);
+
paramRecord.setDatatype(getDatatypeCache().get(paramRecord.getDatatypeUUID()));
+ procedureRecord.getParameters().add(paramRecord);
}
-
- // if the procedure returns a resultSet, obtain resultSet metadata
- String resultID = procRecord.getResultSetID();
+
+ String resultID = procedureRecord.getResultSetID();
if(resultID != null) {
try {
ColumnSetRecordImpl resultRecord = (ColumnSetRecordImpl)
this.getRecordByType(resultID, MetadataConstants.RECORD_TYPE.RESULT_SET);
- // resultSet is the last parameter in the procedure
- int lastParamIndex = procInfo.getParameters().size() + 1;
- SPParameter param = new SPParameter(lastParamIndex,
SPParameter.RESULT_SET, resultRecord.getFullName());
- param.setClassType(java.sql.ResultSet.class);
- param.setMetadataID(resultRecord);
-
loadColumnSetRecords(resultRecord, null);
- for (ColumnRecordImpl columnRecord : resultRecord.getColumns()) {
- String colType = columnRecord.getRuntimeType();
- param.addResultSetColumn(columnRecord.getFullName(),
DataTypeManager.getDataTypeClass(colType), columnRecord);
- }
-
- procInfo.addParameter(param);
+ procedureRecord.setResultSet(resultRecord);
} catch (QueryMetadataException e) {
//it is ok to fail here. it will happen when a
//virtual stored procedure is created from a
@@ -282,39 +253,16 @@
}
// if this is a virtual procedure get the procedure plan
- if(procRecord.isVirtual()) {
- TransformationRecordImpl transformRecord =
(TransformationRecordImpl)getRecordByType(procedureFullName,
MetadataConstants.RECORD_TYPE.PROC_TRANSFORM, false);
+ if(procedureRecord.isVirtual()) {
+ TransformationRecordImpl transformRecord =
(TransformationRecordImpl)getRecordByType(fullyQualifiedProcedureName,
MetadataConstants.RECORD_TYPE.PROC_TRANSFORM, false);
if(transformRecord != null) {
- QueryNode queryNode = new QueryNode(procedureFullName,
transformRecord.getTransformation());
- procInfo.setQueryPlan(queryNode);
-
+ procedureRecord.setQueryPlan(transformRecord.getTransformation());
}
}
-
- //subtract 1, to match up with the server
- procInfo.setUpdateCount(procRecord.getUpdateCount() -1);
- return procInfo;
+ return procedureRecord;
}
- /**
- * Method to convert the parameter type returned from a ProcedureParameterRecord
- * to the parameter type expected by StoredProcedureInfo
- * @param parameterType
- * @return
- */
- private int convertParamRecordTypeToStoredProcedureType(final int parameterType) {
- switch (parameterType) {
- case MetadataConstants.PARAMETER_TYPES.IN_PARM : return SPParameter.IN;
- case MetadataConstants.PARAMETER_TYPES.OUT_PARM : return SPParameter.OUT;
- case MetadataConstants.PARAMETER_TYPES.INOUT_PARM : return
SPParameter.INOUT;
- case MetadataConstants.PARAMETER_TYPES.RETURN_VALUE : return
SPParameter.RETURN_VALUE;
- case MetadataConstants.PARAMETER_TYPES.RESULT_SET : return
SPParameter.RESULT_SET;
- default :
- return -1;
- }
- }
-
@Override
public Collection getXMLTempGroups(TableRecordImpl table) throws
MetaMatrixComponentException {
// Query the index files
Modified: trunk/metadata/src/main/java/org/teiid/metadata/index/RecordFactory.java
===================================================================
--- trunk/metadata/src/main/java/org/teiid/metadata/index/RecordFactory.java 2009-07-10
20:48:29 UTC (rev 1119)
+++ trunk/metadata/src/main/java/org/teiid/metadata/index/RecordFactory.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -806,7 +806,7 @@
paramRd.setPosition(Integer.parseInt((String)tokens.get(tokenIndex++)) );
// The next token is parameter type
- paramRd.setType(Integer.parseInt((String)tokens.get(tokenIndex++)));
+ paramRd.setType(Short.parseShort((String)tokens.get(tokenIndex++)));
// The next token is flag for parameter optional prop
char[] flags = ((String)tokens.get(tokenIndex++)).toCharArray();
Modified:
trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestVDBLessExecution.java
===================================================================
---
trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestVDBLessExecution.java 2009-07-10
20:48:29 UTC (rev 1119)
+++
trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestVDBLessExecution.java 2009-07-11
15:27:48 UTC (rev 1120)
@@ -46,9 +46,9 @@
"y 2" //$NON-NLS-1$
});
- }
+ }
- @Test public void testExecution1() {
+ @Test public void testIntegrationExecution() {
getConnection(VDB, DQP_PROP_FILE);
executeAndAssertResults("select * from Example, Smalla where notional =
intkey", new String[] { //$NON-NLS-1$
"TRADEID[string] NOTIONAL[integer] INTKEY[integer] STRINGKEY[string]
INTNUM[integer] STRINGNUM[string] FLOATNUM[float] LONGNUM[long]
DOUBLENUM[double] BYTENUM[short] DATEVALUE[date] TIMEVALUE[time]
TIMESTAMPVALUE[timestamp] BOOLEANVALUE[short] CHARVALUE[char] SHORTVALUE[short]
BIGINTEGERVALUE[long] BIGDECIMALVALUE[bigdecimal] OBJECTVALUE[string]",
//$NON-NLS-1$
@@ -57,6 +57,14 @@
});
}
+ /**
+ * We have no results to assert here since derby does not provide procedure resultset
columns in their metadata.
+ */
+ @Test public void testProcedureExecution() {
+ getConnection(VDB, DQP_PROP_FILE);
+ execute("exec Derby.SQLUDTS(null, null, null, null, null)");
//$NON-NLS-1$
+ }
+
@Test public void testDatabaseMetaDataTables() throws Exception {
Connection conn = getConnection(VDB, DQP_PROP_FILE);
DatabaseMetaData metadata = conn.getMetaData();
@@ -188,5 +196,31 @@
"null VDBLess Derby.SYSTRIGGERS false null SYSTRIGGERS_INDEX3
0 2 CREATIONTIMESTAMP null 0 1 null", //$NON-NLS-1$
});
}
+
+ @Test public void testDatabaseMetaDataProcedures() throws Exception {
+ Connection conn = getConnection(VDB, DQP_PROP_FILE);
+ DatabaseMetaData metadata = conn.getMetaData();
+ this.internalResultSet = metadata.getProcedures(null, null, "Derby.%JAR");
//$NON-NLS-1$
+ assertResults(new String[] {
+ "PROCEDURE_CAT[string] PROCEDURE_SCHEM[string] PROCEDURE_NAME[string]
RESERVED_1[string] RESERVED_2[string] RESERVED_3[string] REMARKS[string]
PROCEDURE_TYPE[short]", //$NON-NLS-1$
+ "null VDBLess Derby.INSTALL_JAR null null null null
1", //$NON-NLS-1$
+ "null VDBLess Derby.REMOVE_JAR null null null null 1",
//$NON-NLS-1$
+ "null VDBLess Derby.REPLACE_JAR null null null null 1"
//$NON-NLS-1$
+ });
+ }
+
+ @Test public void testDatabaseMetaDataProcedureColumns() throws Exception {
+ Connection conn = getConnection(VDB, DQP_PROP_FILE);
+ DatabaseMetaData metadata = conn.getMetaData();
+ this.internalResultSet = metadata.getProcedureColumns(null, null,
"Derby.SQLUDTS", null); //$NON-NLS-1$
+ assertResults(new String[] {
+ "PROCEDURE_CAT[string] PROCEDURE_SCHEM[string] PROCEDURE_NAME[string]
COLUMN_NAME[string] COLUMN_TYPE[short] DATA_TYPE[integer] TYPE_NAME[string]
PRECISION[integer] LENGTH[integer] SCALE[short] RADIX[integer]
NULLABLE[integer] REMARKS[string] POSITION[integer]", //$NON-NLS-1$
+ "null VDBLess Derby.SQLUDTS CATALOGNAME 1 12 string 128
256 0 0 1 null 1", //$NON-NLS-1$
+ "null VDBLess Derby.SQLUDTS SCHEMAPATTERN 1 12 string 128
256 0 0 1 null 2", //$NON-NLS-1$
+ "null VDBLess Derby.SQLUDTS TYPENAMEPATTERN 1 12 string 128
256 0 0 1 null 3", //$NON-NLS-1$
+ "null VDBLess Derby.SQLUDTS UDTTYPES 1 12 string 128 256
0 0 1 null 4", //$NON-NLS-1$
+ "null VDBLess Derby.SQLUDTS OPTIONS 1 12 string 4000
8000 0 0 1 null 5", //$NON-NLS-1$
+ });
+ }
}