teiid SVN: r2934 - trunk/runtime/src/main/java/org/teiid/deployers.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-02-23 13:51:19 -0500 (Wed, 23 Feb 2011)
New Revision: 2934
Modified:
trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
Log:
TEIID-1480: Teiid was projecting the length of the columns as the attribute lengths; however pg expects them to be the size defined in the pg_type table for that type.
Modified: trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java 2011-02-23 18:23:31 UTC (rev 2933)
+++ trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java 2011-02-23 18:51:19 UTC (rev 2934)
@@ -145,7 +145,7 @@
"st.oid as attrelid, " + //$NON-NLS-1$
"t1.Name as attname, " + //$NON-NLS-1$
"pt.oid as atttypid," + //$NON-NLS-1$
- "convert(t1.Length, short) as attlen, " + //$NON-NLS-1$
+ "pt.typlen as attlen, " + //$NON-NLS-1$
"convert(t1.Position, short) as attnum, " + //$NON-NLS-1$
"t1.Length as atttypmod, " + //$NON-NLS-1$
"false as attnotnull, " + //$NON-NLS-1$
13 years, 10 months
teiid SVN: r2933 - trunk/engine/src/main/java/org/teiid/query/processor/relational.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-23 13:23:31 -0500 (Wed, 23 Feb 2011)
New Revision: 2933
Modified:
trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java
Log:
TEIID-1475 updating the header parsing logic
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java 2011-02-23 18:12:02 UTC (rev 2932)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java 2011-02-23 18:23:31 UTC (rev 2933)
@@ -293,7 +293,7 @@
while (textLine < skip) {
boolean isHeader = textLine == header;
if (isHeader) {
- String line = readLine(lineWidth, false);
+ String line = readLine(DataTypeManager.MAX_STRING_LENGTH * 16, false);
if (line == null) { //just return an empty batch
reset();
return;
@@ -309,6 +309,7 @@
private void processHeader(List<String> line) throws TeiidProcessingException {
nameIndexes = new HashMap<String, Integer>();
+ this.lineWidth = DataTypeManager.MAX_STRING_LENGTH * line.size();
for (String string : line) {
if (string == null) {
continue;
13 years, 10 months
teiid SVN: r2932 - in trunk: connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres and 6 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-23 13:12:02 -0500 (Wed, 23 Feb 2011)
New Revision: 2932
Added:
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/Ingres93ExecutionFactory.java
trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/ingres/
trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/ingres/TestIngresConvertModifier.java
Modified:
trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mm/MetaMatrixExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teiid/TeiidExecutionFactory.java
trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
Log:
TEIID-1059: refining ingres support and making minor updates to the teiidexecutionfactory
Modified: trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2011-02-23 18:08:23 UTC (rev 2931)
+++ trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2011-02-23 18:12:02 UTC (rev 2932)
@@ -787,11 +787,16 @@
/**
* Indicates if LOBs are usable after the execution is closed.
* @return true if LOBs can be used after close
+ * @since 7.2
*/
public boolean areLobsUsableAfterClose() {
return false;
}
+ /**
+ * @return true if the WITH clause is supported
+ * @since 7.2
+ */
public boolean supportsCommonTableExpressions() {
return false;
}
Added: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/Ingres93ExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/Ingres93ExecutionFactory.java (rev 0)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/Ingres93ExecutionFactory.java 2011-02-23 18:12:02 UTC (rev 2932)
@@ -0,0 +1,57 @@
+/*
+ * 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.translator.jdbc.ingres;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.language.Limit;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.Translator;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.jdbc.FunctionModifier;
+
+@Translator(name="ingres93", description="A translator for Ingres 9.3 or later Database")
+public class Ingres93ExecutionFactory extends IngresExecutionFactory {
+
+ @Override
+ public void start() throws TranslatorException {
+ super.start();
+ convert.addTypeMapping("ansidate", FunctionModifier.DATE); //$NON-NLS-1$
+ convert.addTypeMapping("timestamp(9) with time zone", FunctionModifier.TIMESTAMP); //$NON-NLS-1$
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<?> translateLimit(Limit limit, ExecutionContext context) {
+ if (limit.getRowOffset() > 0) {
+ return Arrays.asList("OFFSET ", limit.getRowOffset(), " FETCH FIRST ", limit.getRowLimit(), " ROWS ONLY"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ return super.translateLimit(limit, context);
+ }
+
+ @Override
+ public boolean supportsRowOffset() {
+ return true;
+ }
+
+}
Property changes on: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/Ingres93ExecutionFactory.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java 2011-02-23 18:08:23 UTC (rev 2931)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java 2011-02-23 18:12:02 UTC (rev 2932)
@@ -41,38 +41,31 @@
import org.teiid.translator.jdbc.FunctionModifier;
import org.teiid.translator.jdbc.JDBCExecutionFactory;
-@Translator(name="ingres", description="A translator for Ingres Database")
+@Translator(name="ingres", description="A translator for Ingres Databases")
public class IngresExecutionFactory extends JDBCExecutionFactory {
-
- private static final String INGRES = "ingres"; //$NON-NLS-1$
+ private static final String INGRES = "ingres"; //$NON-NLS-1$
+ protected ConvertModifier convert = new ConvertModifier();
+
@Override
public void start() throws TranslatorException {
super.start();
- ConvertModifier convert = new ConvertModifier();
- convert.addTypeMapping("bit", FunctionModifier.BYTE); //$NON-NLS-1$
- convert.addTypeMapping("boolean", FunctionModifier.BOOLEAN); //$NON-NLS-1$
- convert.addTypeMapping("tinyint", FunctionModifier.BYTE); //$NON-NLS-1$
+ convert.addTypeMapping("tinyint", FunctionModifier.BOOLEAN, FunctionModifier.BYTE); //$NON-NLS-1$
convert.addTypeMapping("smallint", FunctionModifier.SHORT); //$NON-NLS-1$
convert.addTypeMapping("integer", FunctionModifier.INTEGER); //$NON-NLS-1$
convert.addTypeMapping("bigint", FunctionModifier.LONG); //$NON-NLS-1$
convert.addTypeMapping("real", FunctionModifier.FLOAT); //$NON-NLS-1$
convert.addTypeMapping("float", FunctionModifier.DOUBLE); //$NON-NLS-1$
- convert.addTypeMapping("decimal(15,0)", FunctionModifier.BIGDECIMAL); //$NON-NLS-1$
- convert.addTypeMapping("decimal(38,0)", FunctionModifier.BIGINTEGER); //$NON-NLS-1$
+ convert.addTypeMapping("decimal(38,19)", FunctionModifier.BIGDECIMAL); //$NON-NLS-1$
+ convert.addTypeMapping("decimal(15,0)", FunctionModifier.BIGINTEGER); //$NON-NLS-1$
convert.addTypeMapping("date", FunctionModifier.DATE); //$NON-NLS-1$
convert.addTypeMapping("time with time zone", FunctionModifier.TIME); //$NON-NLS-1$
convert.addTypeMapping("timestamp with time zone", FunctionModifier.TIMESTAMP); //$NON-NLS-1$
convert.addTypeMapping("char(1)", FunctionModifier.CHAR); //$NON-NLS-1$
- convert.addTypeMapping("varchar($1)", FunctionModifier.STRING); //$NON-NLS-1$
- convert.addTypeMapping("long varchar", FunctionModifier.STRING); //$NON-NLS-1$
+ convert.addTypeMapping("varchar(4000)", FunctionModifier.STRING); //$NON-NLS-1$
convert.addTypeMapping("blob", FunctionModifier.BLOB); //$NON-NLS-1$
convert.addTypeMapping("clob", FunctionModifier.CLOB); //$NON-NLS-1$
- convert.addTypeMapping("byte($1)", FunctionModifier.OBJECT); //$NON-NLS-1$
- convert.addTypeMapping("long byte", FunctionModifier.OBJECT); //$NON-NLS-1$
- convert.addTypeMapping("varbyte($1)", FunctionModifier.OBJECT); //$NON-NLS-1$
- convert.addTypeMapping("ansidate", FunctionModifier.DATE); //$NON-NLS-1$
- convert.addTypeMapping("timestamp(9) with time zone", FunctionModifier.TIMESTAMP); //$NON-NLS-1$
+ convert.addNumericBooleanConversions();
registerFunctionModifier(SourceSystemFunctions.CONVERT, convert);
}
@@ -272,4 +265,5 @@
public boolean supportsInlineViews() {
return true;
}
+
}
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mm/MetaMatrixExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mm/MetaMatrixExecutionFactory.java 2011-02-23 18:08:23 UTC (rev 2931)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mm/MetaMatrixExecutionFactory.java 2011-02-23 18:12:02 UTC (rev 2932)
@@ -14,7 +14,7 @@
/**
* Capabilities compatible with MM 5.5.x
*/
-@Translator(name="metamatrix", description="A translator for MetaMatrix Virtual Database")
+@Translator(name="metamatrix", description="A translator for MetaMatrix 5.5 or later")
public class MetaMatrixExecutionFactory extends JDBCExecutionFactory {
public List<String> getSupportedFunctions() {
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teiid/TeiidExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teiid/TeiidExecutionFactory.java 2011-02-23 18:08:23 UTC (rev 2931)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teiid/TeiidExecutionFactory.java 2011-02-23 18:12:02 UTC (rev 2932)
@@ -27,19 +27,21 @@
import java.util.ArrayList;
import java.util.List;
+import org.teiid.translator.SourceSystemFunctions;
import org.teiid.translator.Translator;
-import org.teiid.translator.ExecutionFactory.NullOrder;
import org.teiid.translator.jdbc.JDBCExecutionFactory;
-
/**
* @since 4.3
*/
-@Translator(name="teiid", description="A translator for Teiid Virtual Database")
+@Translator(name="teiid", description="A translator for Teiid 7.0 or later")
public class TeiidExecutionFactory extends JDBCExecutionFactory {
public static final String SEVEN_0 = "7.0"; //$NON-NLS-1$
public static final String SEVEN_1 = "7.1"; //$NON-NLS-1$
+ public static final String SEVEN_2 = "7.2"; //$NON-NLS-1$
+ public static final String SEVEN_3 = "7.3"; //$NON-NLS-1$
+ public static final String SEVEN_4 = "7.4"; //$NON-NLS-1$
public TeiidExecutionFactory() {
setDatabaseVersion(SEVEN_0);
@@ -139,6 +141,17 @@
supportedFunctions.add("FROM_UNIXTIME"); //$NON-NLS-1$
supportedFunctions.add("NULLIF"); //$NON-NLS-1$
supportedFunctions.add("COALESCE"); //$NON-NLS-1$
+
+ if (getDatabaseVersion().compareTo(SEVEN_3) >= 0) {
+ supportedFunctions.add(SourceSystemFunctions.UNESCAPE);
+
+ if (getDatabaseVersion().compareTo(SEVEN_4) >= 0) {
+ supportedFunctions.add(SourceSystemFunctions.UUID);
+ supportedFunctions.add(SourceSystemFunctions.ARRAY_GET);
+ supportedFunctions.add(SourceSystemFunctions.ARRAY_LENGTH);
+ }
+ }
+
return supportedFunctions;
}
@@ -178,4 +191,14 @@
public NullOrder getDefaultNullOrder() {
return NullOrder.UNKNOWN;
}
+
+ @Override
+ public boolean supportsBulkUpdate() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsCommonTableExpressions() {
+ return getDatabaseVersion().compareTo(SEVEN_2) >= 0;
+ }
}
Added: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/ingres/TestIngresConvertModifier.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/ingres/TestIngresConvertModifier.java (rev 0)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/ingres/TestIngresConvertModifier.java 2011-02-23 18:12:02 UTC (rev 2932)
@@ -0,0 +1,126 @@
+/*
+ * 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.translator.jdbc.ingres;
+
+import static org.junit.Assert.*;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.sql.Timestamp;
+import java.util.Arrays;
+
+import org.junit.Test;
+import org.teiid.language.Expression;
+import org.teiid.language.Function;
+import org.teiid.language.LanguageFactory;
+import org.teiid.query.unittest.TimestampUtil;
+import org.teiid.translator.TypeFacility;
+import org.teiid.translator.jdbc.SQLConversionVisitor;
+/**
+ */
+public class TestIngresConvertModifier {
+
+ private static final LanguageFactory LANG_FACTORY = new LanguageFactory();
+
+ public String helpGetString(Expression expr) throws Exception {
+ IngresExecutionFactory trans = new IngresExecutionFactory();
+ trans.start();
+ SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor();
+ sqlVisitor.append(expr);
+
+ return sqlVisitor.toString();
+ }
+
+ public void helpTest(Expression srcExpression, String tgtType, String expectedExpression) throws Exception {
+ Function func = LANG_FACTORY.createFunction("convert", //$NON-NLS-1$
+ Arrays.asList(
+ srcExpression,
+ LANG_FACTORY.createLiteral(tgtType, String.class)),
+ TypeFacility.getDataTypeClass(tgtType));
+
+ assertEquals("Error converting from " + srcExpression.getType() + " to " + tgtType, //$NON-NLS-1$ //$NON-NLS-2$
+ expectedExpression, helpGetString(func));
+ }
+
+ // Source = STRING
+ @Test public void testStringToChar() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral("5", String.class), "char", "cast('5' AS char(1))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ @Test public void testBooleanToBigDecimal() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "bigdecimal", "cast(1 AS decimal(38,19))"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ // Source = BYTE
+
+ @Test public void testByteToString() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "string", "cast(1 AS varchar(4000))"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test public void testByteToBoolean() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "boolean", "CASE WHEN 1 = 0 THEN 0 WHEN 1 IS NOT NULL THEN 1 END"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test public void testBigIntegerToDouble() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "double", "cast(1 AS float)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ // Source = FLOAT
+
+ @Test public void testFloatToLong() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "long", "cast(1.2 AS bigint)"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ // Source = DOUBLE
+
+ @Test public void testDoubleToShort() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "short", "cast(1.2 AS smallint)"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ // Source = BIGDECIMAL
+
+ @Test public void testBigDecimalToByte() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "byte", "cast(1.0 AS tinyint)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ // Source = DATE
+
+ @Test public void testDateToTimestamp() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "timestamp", "cast(DATE '2003-11-01' AS timestamp with time zone)"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ // Source = TIME
+
+ @Test public void testTimeToString() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "string", "cast(TIME '23:59:59' AS varchar(4000))"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+
+ // Source = TIMESTAMP
+
+ @Test public void testTimestampToString() throws Exception {
+ Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);
+ helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "cast(TIMESTAMP '2003-11-01 12:05:02.0' AS varchar(4000))"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+}
Property changes on: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/ingres/TestIngresConvertModifier.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
===================================================================
--- trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2011-02-23 18:08:23 UTC (rev 2931)
+++ trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2011-02-23 18:12:02 UTC (rev 2932)
@@ -268,7 +268,7 @@
<section>
<title>Bulk Execution</title>
- <para> Non batched <code>Insert, Update, Delete</code>
+ <para>Non batched <code>Insert, Update, Delete</code>
commands may have <code>Literal</code> values marked as multiValued if the
capabilities shows support for BulkUpdate. Commands with
multiValued <code>Literal</code>s represent multiple executions of the same
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml 2011-02-23 18:08:23 UTC (rev 2931)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml 2011-02-23 18:12:02 UTC (rev 2932)
@@ -237,6 +237,16 @@
</listitem>
<listitem>
<para>
+ <emphasis>ingres</emphasis> - for use with Ingres 2006 or later.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>ingres93</emphasis> - for use with Ingres 9.3 or later.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
<emphasis>informix</emphasis> - for use with any version.
</para>
</listitem>
@@ -303,12 +313,7 @@
<para>
<emphasis>teradata</emphasis> - for use with Teradata V2R5.1 or later.
</para>
- </listitem>
- <listitem>
- <para>
- <emphasis>ingres</emphasis> - for use with Ingres Database 9.2 or later.
- </para>
- </listitem>
+ </listitem>
</itemizedlist>
<table>
13 years, 10 months
teiid SVN: r2931 - in branches/7.1.x/runtime/src/main/java/org/teiid: odbc and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-02-23 13:08:23 -0500 (Wed, 23 Feb 2011)
New Revision: 2931
Modified:
branches/7.1.x/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
branches/7.1.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
Log:
TEIID-1477: Adding support to handle "select version()" call, and couple other 'select' call I have seen with the other tools. Also fixed bug in specifying the pg_type so that pg_attribute transformation returns correct type for the table columns
Modified: branches/7.1.x/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
===================================================================
--- branches/7.1.x/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java 2011-02-23 17:57:40 UTC (rev 2930)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java 2011-02-23 18:08:23 UTC (rev 2931)
@@ -369,7 +369,7 @@
" union " + //$NON-NLS-1$
"SELECT 20 as oid, 'long' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace, convert(8, short) as typlen, convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid FROM (SELECT 1) X" + //$NON-NLS-1$
" union " + //$NON-NLS-1$
- "SELECT 23 as oid, 'int' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace, convert(4, short) as typlen, convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid FROM (SELECT 1) X" + //$NON-NLS-1$
+ "SELECT 23 as oid, 'integer' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace, convert(4, short) as typlen, convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid FROM (SELECT 1) X" + //$NON-NLS-1$
" union " + //$NON-NLS-1$
"SELECT 26 as oid, 'oid' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typname, convert(4, short) as typlen, convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid FROM (SELECT 1) X" + //$NON-NLS-1$
" union " + //$NON-NLS-1$
Modified: branches/7.1.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
===================================================================
--- branches/7.1.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2011-02-23 17:57:40 UTC (rev 2930)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2011-02-23 18:08:23 UTC (rev 2931)
@@ -34,6 +34,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.teiid.core.util.ApplicationInfo;
import org.teiid.jdbc.ConnectionImpl;
import org.teiid.jdbc.TeiidDriver;
import org.teiid.logging.LogConstants;
@@ -300,7 +301,8 @@
// set client_encoding to 'WIN1252'
if (sql != null) {
// selects are coming with "select\t" so using a space after "select" does not always work
- if (sql.startsWith("select") || sql.startsWith("SELECT")) { //$NON-NLS-1$ //$NON-NLS-2$
+ String sqlLower = sql.toLowerCase();
+ if (sqlLower.startsWith("select")) { //$NON-NLS-1$
modified = sql.replace('\n', ' ');
Matcher m = null;
@@ -321,6 +323,15 @@
"FKTABLE_NAME, FKCOLUMN_NAME, KEY_SEQ, UPDATE_RULE, DELETE_RULE, FK_NAME, PK_NAME, DEFERRABILITY "+//$NON-NLS-1$
"FROM SYS.ReferenceKeyColumns WHERE PKTABLE_NAME LIKE '"+m.group(14)+"' and PKTABLE_SCHEM LIKE '"+m.group(15)+"'";//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
+ else if (modified.equalsIgnoreCase("select version()")) { //$NON-NLS-1$
+ modified = "SELECT 'Teiid "+ApplicationInfo.getInstance().getReleaseNumber()+"'"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ else if (modified.startsWith("SELECT name FROM master..sysdatabases")) { //$NON-NLS-1$
+ modified = "SELECT 'Teiid'"; //$NON-NLS-1$
+ }
+ else if (modified.equalsIgnoreCase("select db_name() dbname")) { //$NON-NLS-1$
+ modified = "SELECT current_database()"; //$NON-NLS-1$
+ }
else {
modified = modified.replaceAll("E'", "'"); //$NON-NLS-1$ //$NON-NLS-2$
modified = modified.replaceAll("::[A-Za-z0-9]*", " "); //$NON-NLS-1$ //$NON-NLS-2$
@@ -342,8 +353,11 @@
if (m.matches()) {
if (m.group(2).equalsIgnoreCase("client_encoding")) { //$NON-NLS-1$
this.client.setEncoding(PGCharsetConverter.getCharset(m.group(4)));
- modified = "SELECT 'SET'"; //$NON-NLS-1$
}
+ else {
+ this.props.setProperty(m.group(2), m.group(4));
+ }
+ modified = "SELECT 'SET'"; //$NON-NLS-1$
}
else if (modified.equalsIgnoreCase("BEGIN")) { //$NON-NLS-1$
try {
13 years, 10 months
teiid SVN: r2930 - in trunk: runtime/src/main/java/org/teiid/deployers and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-23 12:57:40 -0500 (Wed, 23 Feb 2011)
New Revision: 2930
Modified:
trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
Log:
TEIID-1470 updating dynamic vdb deployment logic
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2011-02-23 16:03:16 UTC (rev 2929)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2011-02-23 17:57:40 UTC (rev 2930)
@@ -25,6 +25,7 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
@@ -52,6 +53,7 @@
@ManagementObject(properties=ManagementProperties.EXPLICIT)
public class ModelMetaData extends AdminObjectImpl implements Model {
+ private static final int DEFAULT_ERROR_HISTORY = 10;
private static final String SUPPORTS_MULTI_SOURCE_BINDINGS_KEY = "supports-multi-source-bindings"; //$NON-NLS-1$
private static final long serialVersionUID = 3714234763056162230L;
@@ -229,10 +231,13 @@
public synchronized ValidationError addError(String severity, String message) {
if (this.errors == null) {
- this.errors = new ArrayList<ValidationError>();
+ this.errors = new LinkedList<ValidationError>();
}
ValidationError ve = new ValidationError(severity, message);
this.errors.add(ve);
+ if (this.errors.size() > DEFAULT_ERROR_HISTORY) {
+ this.errors.remove(0);
+ }
return ve;
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2011-02-23 16:03:16 UTC (rev 2929)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2011-02-23 17:57:40 UTC (rev 2930)
@@ -43,7 +43,6 @@
import org.teiid.adminapi.impl.SourceMappingMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
-import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
import org.teiid.dqp.internal.datamgr.TranslatorRepository;
@@ -323,7 +322,7 @@
*/
private Boolean loadMetadata(VDBMetaData vdb, ModelMetaData model, boolean cache, File cacheFile, MetadataStoreGroup vdbStore, ConnectorManagerRepository cmr) {
String msg = RuntimePlugin.Util.getString("model_metadata_loading", vdb.getName()+"-"+vdb.getVersion(), model.getName(), SimpleDateFormat.getInstance().format(new Date())); //$NON-NLS-1$ //$NON-NLS-2$
- final ValidationError addedError = model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg);
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg);
LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
String exceptionMessage = null;
@@ -342,7 +341,6 @@
this.serializer.saveAttachment(cacheFile, store);
}
vdbStore.addStore(store);
- model.removeError(addedError);
loaded = true;
break;
} catch (TranslatorException e) {
@@ -366,10 +364,13 @@
model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), exceptionMessage);
}
LogManager.logWarning(LogConstants.CTX_RUNTIME, failed_msg);
- } else if (vdb.isValid()) {
- this.vdbRepository.updateVDB(vdb.getName(), vdb.getVersion());
- vdb.setStatus(VDB.Status.ACTIVE);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+ } else {
+ model.clearErrors();
+ if (vdb.isValid()) {
+ this.vdbRepository.updateVDB(vdb.getName(), vdb.getVersion());
+ vdb.setStatus(VDB.Status.ACTIVE);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+ }
}
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2011-02-23 16:03:16 UTC (rev 2929)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2011-02-23 17:57:40 UTC (rev 2930)
@@ -84,7 +84,6 @@
String sourceName = getSourceName(resourceName, model, translator);
if (sourceName != null) {
ConnectorManager cm = cmr.getConnectorManager(sourceName);
- model.clearErrors();
String status = cm.getStausMessage();
if (status != null && status.length() > 0) {
model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), status);
@@ -94,6 +93,8 @@
Runnable r = model.removeAttachment(Runnable.class);
if (r != null) {
runnables.add(r);
+ } else {
+ model.clearErrors();
}
}
}
13 years, 10 months
teiid SVN: r2929 - trunk/build/kits/jboss-container.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-02-23 11:03:16 -0500 (Wed, 23 Feb 2011)
New Revision: 2929
Modified:
trunk/build/kits/jboss-container/teiid-releasenotes.html
Log:
TEIID-1059: Adding translator for Ingres database.
Modified: trunk/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-container/teiid-releasenotes.html 2011-02-23 16:00:02 UTC (rev 2928)
+++ trunk/build/kits/jboss-container/teiid-releasenotes.html 2011-02-23 16:03:16 UTC (rev 2929)
@@ -36,6 +36,7 @@
<LI><B>array_length</B> was added to get the length of java.sql.Array or java array values.
</UL>
<LI><B>ARRAYTABLE</B> - the ARRAYTABLE table function was added to simplify array value extraction into a tabular format.
+ <LI><B>Ingres</B> - Ingres database translator is now available to use as supported source under Teiid.
</UL>
<h2><a name="Compatibility">Compatibility Issues</a></h2>
13 years, 10 months
teiid SVN: r2928 - trunk/documentation/reference/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-02-23 11:00:02 -0500 (Wed, 23 Feb 2011)
New Revision: 2928
Modified:
trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
Log:
TEIID-1059: Adding translator for Ingres database.
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml 2011-02-23 15:30:48 UTC (rev 2927)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml 2011-02-23 16:00:02 UTC (rev 2928)
@@ -304,6 +304,11 @@
<emphasis>teradata</emphasis> - for use with Teradata V2R5.1 or later.
</para>
</listitem>
+ <listitem>
+ <para>
+ <emphasis>ingres</emphasis> - for use with Ingres Database 9.2 or later.
+ </para>
+ </listitem>
</itemizedlist>
<table>
13 years, 10 months
teiid SVN: r2927 - trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/postgresql.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-23 10:30:48 -0500 (Wed, 23 Feb 2011)
New Revision: 2927
Modified:
trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/postgresql/TestPostgreSQLTranslator.java
Log:
TEIID-247 adding h2 and postgres pushdown support for array functions
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 2011-02-23 15:30:32 UTC (rev 2926)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/postgresql/TestPostgreSQLTranslator.java 2011-02-23 15:30:48 UTC (rev 2927)
@@ -535,5 +535,14 @@
input, output,
TRANSLATOR);
}
+
+ @Test public void testArrayFunctions() throws Exception {
+ String input = "SELECT array_get(objectvalue, 3), array_length(objectvalue) FROM BQT1.SMALLA"; //$NON-NLS-1$
+ String output = "SELECT SmallA.ObjectValue[3], array_length(SmallA.ObjectValue, 1) FROM SmallA"; //$NON-NLS-1$
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB,
+ input, output,
+ TRANSLATOR);
+ }
}
13 years, 10 months
teiid SVN: r2926 - in trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc: postgresql and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-23 10:30:32 -0500 (Wed, 23 Feb 2011)
New Revision: 2926
Modified:
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/h2/H2ExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java
Log:
TEIID-247 adding h2 and postgres pushdown support for array functions
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/h2/H2ExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/h2/H2ExecutionFactory.java 2011-02-23 01:53:08 UTC (rev 2925)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/h2/H2ExecutionFactory.java 2011-02-23 15:30:32 UTC (rev 2926)
@@ -165,6 +165,8 @@
supportedFunctions.add(SourceSystemFunctions.CONVERT);
supportedFunctions.add(SourceSystemFunctions.IFNULL);
supportedFunctions.add(SourceSystemFunctions.COALESCE);
+ supportedFunctions.add(SourceSystemFunctions.ARRAY_GET);
+ supportedFunctions.add(SourceSystemFunctions.ARRAY_LENGTH);
return supportedFunctions;
}
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 2011-02-23 01:53:08 UTC (rev 2925)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java 2011-02-23 15:30:32 UTC (rev 2926)
@@ -110,6 +110,24 @@
//specific to 8.2 client or later
registerFunctionModifier(SourceSystemFunctions.TIMESTAMPADD, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.TIMESTAMPDIFF, new EscapeSyntaxModifier());
+
+ registerFunctionModifier(SourceSystemFunctions.ARRAY_GET, new FunctionModifier() {
+
+ @Override
+ public List<?> translate(Function function) {
+ return Arrays.asList(function.getParameters().get(0), '[', function.getParameters().get(1), ']');
+ }
+ });
+ registerFunctionModifier(SourceSystemFunctions.ARRAY_LENGTH, new FunctionModifier() {
+
+ @Override
+ public List<?> translate(Function function) {
+ if (function.getParameters().size() == 1) {
+ function.getParameters().add(new Literal(1, TypeFacility.RUNTIME_TYPES.INTEGER));
+ }
+ return null;
+ }
+ });
//add in type conversion
ConvertModifier convertModifier = new ConvertModifier();
@@ -427,6 +445,8 @@
// supportedFunctions.add("USER"); //$NON-NLS-1$ // no ()
// supportedFunctions.add("VERSION"); //$NON-NLS-1$
//
+ supportedFunctions.add(SourceSystemFunctions.ARRAY_GET);
+ supportedFunctions.add(SourceSystemFunctions.ARRAY_LENGTH);
return supportedFunctions;
}
13 years, 10 months
teiid SVN: r2925 - trunk/documentation/reference/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-22 20:53:08 -0500 (Tue, 22 Feb 2011)
New Revision: 2925
Modified:
trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
Log:
TEIID-1479 added a blurb about sql server
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml 2011-02-23 01:33:24 UTC (rev 2924)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml 2011-02-23 01:53:08 UTC (rev 2925)
@@ -286,6 +286,11 @@
</listitem>
<listitem>
<para>
+ <emphasis>sqlserver</emphasis> - for use with SQL Server 2000 or later. A SQL Server JDBC driver version 2.0 or later (or compatible e.g. JTDS 1.2 or later) should be used.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
<emphasis>sybase</emphasis> - for use with Sybase version 12.5 or later.
</para>
</listitem>
13 years, 10 months