Skip to content

Commit

Permalink
TEIID-4578 sqlalchemy support
Browse files Browse the repository at this point in the history
# Conflicts:
#	engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
#	engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
#	engine/src/main/resources/org/teiid/metadata/SYS.sql
#	jboss-integration/kits/wildfly/docs/teiid/teiid-releasenotes.html
#	runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
#	runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
#	test-integration/common/src/test/resources/TestCase3473/testGetTables.expected
#	test-integration/common/src/test/resources/TestJDBCSocketTransport/testSelect.expected
#	test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetColumns.expected
#	test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetFunctionColumns.expected
#	test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetFunctions.expected
#	test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRDEF.expected
#	test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected
#	test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE_overflow.expected
#	test-integration/common/src/test/resources/TestODBCSchema/test_PG_CLASS.expected
#	test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected
#	test-integration/common/src/test/resources/TestODBCSocketTransport/testSelect.expected
#	test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testColumns.expected
#	test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected
#	test-integration/common/src/test/resources/TestSystemVirtualModel/testFunctionParams.expected
#	test-integration/common/src/test/resources/TestSystemVirtualModel/testFunctions.expected
#	test-integration/common/src/test/resources/TestSystemVirtualModel/testKeys.expected
#	test-integration/common/src/test/resources/TestSystemVirtualModel/testProperties.expected
#	test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected
#	test-integration/common/src/test/resources/TestSystemVirtualModel/testViews.expected
#	test-integration/common/src/test/resources/TestVirtualDocWithVirtualProc/testDefect15241b.expected
  • Loading branch information
shawkins committed Jun 29, 2017
1 parent b53295b commit 1709e99
Show file tree
Hide file tree
Showing 40 changed files with 1,932 additions and 1,683 deletions.
26 changes: 25 additions & 1 deletion client/src/main/java/org/teiid/jdbc/StatementImpl.java
Expand Up @@ -162,7 +162,7 @@ enum State {
static Pattern TRANSACTION_STATEMENT = Pattern.compile("\\s*(commit|rollback|(start\\s+transaction))\\s*;?\\s*", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
static Pattern SET_STATEMENT = Pattern.compile("\\s*set(?:\\s+(payload))?\\s+((?:session authorization)|(?:[a-zA-Z]\\w*)|(?:\"[^\"]*\")+)\\s+(?:to\\s+)?((?:[^\\s]*)|(?:'[^']*')+)\\s*;?\\s*", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
static Pattern SET_CHARACTERISTIC_STATEMENT = Pattern.compile("\\s*set\\s+session\\s+characteristics\\s+as\\s+transaction\\s+isolation\\s+level\\s+((?:read\\s+(?:(?:committed)|(?:uncommitted)))|(?:repeatable\\s+read)|(?:serializable))\\s*", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
static Pattern SHOW_STATEMENT = Pattern.compile("\\s*show\\s+([a-zA-Z]\\w*|(?:\"[^\"]*\")+)\\s*;?\\s*?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
static Pattern SHOW_STATEMENT = Pattern.compile("\\s*show\\s+((?:transaction isolation level)|(?:[a-zA-Z]\\w*)|(?:\"[^\"]*\")+)\\s*;?\\s*", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$

/**
* MMStatement Constructor.
Expand Down Expand Up @@ -646,6 +646,30 @@ ResultsFuture<Boolean> executeShow(Matcher match)
new String[] {DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
return booleanFuture(true);
}
if (show.equalsIgnoreCase("transaction isolation level")) { //$NON-NLS-1$
List<ArrayList<Object>> records = new ArrayList<ArrayList<Object>>(1);
ArrayList<Object> row = new ArrayList<Object>(1);
switch (driverConnection.getTransactionIsolation()) {
case Connection.TRANSACTION_READ_COMMITTED:
row.add("READ COMMITTED"); //$NON-NLS-1$
break;
case Connection.TRANSACTION_READ_UNCOMMITTED:
row.add("READ UNCOMMITTED"); //$NON-NLS-1$
break;
case Connection.TRANSACTION_REPEATABLE_READ:
row.add("REPEATABLE READ"); //$NON-NLS-1$
break;
case Connection.TRANSACTION_SERIALIZABLE:
row.add("SERIALIZABLE"); //$NON-NLS-1$
break;
default:
row.add("UNKNOWN"); //$NON-NLS-1$
}
records.add(row);
createResultSet(records, new String[] {"TRANSACTION ISOLATION"}, //$NON-NLS-1$
new String[] {DataTypeManager.DefaultDataTypes.STRING});
return booleanFuture(true);
}
List<List<String>> records = Collections.singletonList(Collections.singletonList(driverConnection.getExecutionProperty(show)));
createResultSet(records, new String[] {show}, new String[] {DataTypeManager.DefaultDataTypes.STRING});
return booleanFuture(true);
Expand Down
17 changes: 17 additions & 0 deletions client/src/test/java/org/teiid/jdbc/TestStatement.java
Expand Up @@ -32,6 +32,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.TimeZone;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;

Expand Down Expand Up @@ -295,4 +296,20 @@ public Boolean answer(InvocationOnMock invocation) throws Throwable {
Mockito.verify(conn).setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
}

@Test public void testShowTxnIsolationLevel() throws SQLException {
ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY) {
@Override
protected TimeZone getServerTimeZone() throws SQLException {
return TimeZone.getDefault();
}
};
Mockito.stub(conn.getTransactionIsolation()).toReturn(Connection.TRANSACTION_READ_COMMITTED);
assertTrue(statement.execute("show transaction isolation level")); //$NON-NLS-1$
ResultSet rs = statement.getResultSet();
rs.next();
assertEquals("READ COMMITTED", rs.getString(1));
assertFalse(rs.next());
}

}
Expand Up @@ -742,7 +742,20 @@ protected void fillRow(List<Object> row, KeyRecord key,
row.add(false);
row.add((key instanceof ForeignKey)?((ForeignKey)key).getUniqueKeyID():null);
row.add(key.getUUID());
row.add(key.getParent().getUUID());
row.add(null);
if (key instanceof ForeignKey) {
KeyRecord ref = ((ForeignKey)key).getReferenceKey();
if (ref != null) {
row.set(row.size() - 1, ref.getParent().getUUID());
}
}
List<Column> columns2 = key.getColumns();
Short[] pos = new Short[columns2.size()];
for (int i = 0; i < pos.length; i++) {
pos[i] = (short)columns2.get(i).getPosition();
}
row.add(new ArrayImpl((Object[])pos));
}

@Override
Expand Down
Expand Up @@ -281,7 +281,7 @@ public String getMessage(ParseException pe, int maxExpansions) {
String img = tokenImage[t];
if (id && img.startsWith("\"") //$NON-NLS-1$
&& Character.isLetter(img.charAt(1))
&& !SQLConstants.isReservedWord(img.substring(1, img.length()-1))) {
&& (!SQLConstants.isReservedWord(img.substring(1, img.length()-1)) || img.equals("\"default\""))) { //$NON-NLS-1$
continue;
}
if (count > 0) {
Expand Down
5 changes: 2 additions & 3 deletions engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
Expand Up @@ -188,7 +188,6 @@ TOKEN : /* Reserved words */
| <CURSOR: "cursor">
| <DAY: "day">
| <DEALLOCATE: "deallocate">
| <DEFAULT_KEYWORD: "default">
| <DECLARE: "declare">
| <DELETE: "delete">
| <DESC: "desc">
Expand Down Expand Up @@ -496,7 +495,7 @@ TOKEN : /* NonReserved words */
| <JSONOBJECT: "jsonobject">
| <PRESERVE: "preserve">
| <GEOMETRY: "geometry">

| <DEFAULT_KEYWORD: "default">
}
/*
name=all in group identifier
Expand Down Expand Up @@ -605,7 +604,7 @@ Token nonReserved() :
|<SQL_TSI_SECOND>|<SQL_TSI_MINUTE>|<SQL_TSI_HOUR>|<SQL_TSI_DAY>|<SQL_TSI_WEEK>|<SQL_TSI_MONTH>|<SQL_TSI_QUARTER>|<SQL_TSI_YEAR>|<TEXTTABLE>|<ARRAYTABLE>
|<SELECTOR>|<SKIP_KEYWORD>|<WIDTH>|<PASSING>|<NAME>|<ENCODING>|<COLUMNS>|<DELIMITER>|<QUOTE>|<HEADER>|<NULLS>|<OBJECTTABLE>
|<VERSION>|<INCLUDING>|<EXCLUDING>|<XMLDECLARATION>|<VARIADIC>|<RAISE>|<EXCEPTION>|<CHAIN>|<JSONARRAY_AGG>|<JSONOBJECT>|<PRESERVE>
|<GEOMETRY>)
|<GEOMETRY>|<DEFAULT_KEYWORD>)
{
return getToken(0);
}
Expand Down
4 changes: 3 additions & 1 deletion engine/src/main/resources/org/teiid/metadata/SYS.sql
Expand Up @@ -86,7 +86,9 @@ CREATE FOREIGN TABLE Keys (
IsIndexed boolean NOT NULL,
RefKeyUID string(50),
UID string(50) NOT NULL,
OID integer,
TableUID string(50) NOT NULL,
RefTableUID string(50) NOT NULL,
ColPositions short[] NOT NULL,
PRIMARY KEY (VDBName, SchemaName, TableName, Name),
FOREIGN KEY (VDBName, SchemaName, TableName) REFERENCES Tables (VDBName, SchemaName, Name),
UNIQUE (UID)
Expand Down
Expand Up @@ -34,6 +34,7 @@ <H2><A NAME="Highlights"></A>Highlights</H2>
<li><a href="https://issues.jboss.org/browse/TEIID-4378">TEIID-4378</a> <a href="https://issues.jboss.org/browse/TEIID-4376">TEIID-4376</a> <b>Clob enhancements</b> to support concat and use in EXECUTE IMMEDIATE.
<li><a href="https://issues.jboss.org/browse/TEIID-4100">TEIID-4100</a> <b>OData expand</b> support for siblings and nested expands.
<li><a href="https://issues.jboss.org/browse/TEIID-4100">TEIID-4393</a> <b>Additional Geospatial Functions</b> to more fully support the SQL-MM specification.
<li><a href="https://issues.jboss.org/browse/TEIID-4578">TEIID-4578</a> <b>SQLAlchemy</b> support through our pg/odbc access.
</ul>

<h2><a name="Compatibility">Compatibility Issues</a></h2>
Expand Down
Expand Up @@ -30,6 +30,7 @@
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

Expand All @@ -53,7 +54,6 @@
import org.teiid.metadata.Table.Type;
import org.teiid.odbc.ODBCServerRemoteImpl;
import org.teiid.query.function.GeometryFunctionMethods;
import org.teiid.query.metadata.MaterializationMetadataRepository;
import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.parser.SQLParserUtil;
import org.teiid.query.resolver.util.ResolverUtil;
Expand Down Expand Up @@ -87,6 +87,7 @@ public PgCatalogMetadataStore(String modelName, Map<String, Datatype> dataTypes)
add_pg_inherits();
add_pg_stats();
add_geography_columns();
add_pg_constraint();
addFunction("regClass", "regclass").setNullOnNull(true); //$NON-NLS-1$ //$NON-NLS-2$
addFunction("encode", "encode").setPushdown(PushDown.CAN_PUSHDOWN); //$NON-NLS-1$ //$NON-NLS-2$
addFunction("objDescription", "obj_description"); //$NON-NLS-1$ //$NON-NLS-2$
Expand All @@ -105,14 +106,38 @@ public PgCatalogMetadataStore(String modelName, Map<String, Datatype> dataTypes)
addFunction("hasPerm", "has_function_privilege"); //$NON-NLS-1$ //$NON-NLS-2$
addFunction("getExpr2", "pg_get_expr"); //$NON-NLS-1$ //$NON-NLS-2$
addFunction("getExpr3", "pg_get_expr"); //$NON-NLS-1$ //$NON-NLS-2$
addFunction("pg_table_is_visible", "pg_table_is_visible"); //$NON-NLS-1$ //$NON-NLS-2$
addFunction("pg_get_constraintdef", "pg_get_constraintdef"); //$NON-NLS-1$ //$NON-NLS-2$
addFunction("pg_type_is_visible", "pg_type_is_visible"); //$NON-NLS-1$ //$NON-NLS-2$
FunctionMethod func = addFunction("asPGVector", "asPGVector"); //$NON-NLS-1$ //$NON-NLS-2$
func.setProperty(ResolverVisitor.TEIID_PASS_THROUGH_TYPE, Boolean.TRUE.toString());
addFunction("getOid", "getOid"); //$NON-NLS-1$ //$NON-NLS-2$
addFunction("getOid", "getOid").setNullOnNull(true);; //$NON-NLS-1$ //$NON-NLS-2$
func = addFunction("pg_client_encoding", "pg_client_encoding"); //$NON-NLS-1$ //$NON-NLS-2$
func.setDeterminism(Determinism.COMMAND_DETERMINISTIC);
}

private void add_pg_prepared_xacts() {
private Table add_pg_constraint() {
Table t = createView("pg_constraint"); //$NON-NLS-1$

addColumn("oid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
addColumn("conname", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
addColumn("contype", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
addColumn("consrc", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
addColumn("conrelid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
addColumn("confrelid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
addColumn("conkey", DataTypeManager.getDataTypeName(DataTypeManager.getArrayType(DataTypeManager.DefaultDataClasses.SHORT)), t); //$NON-NLS-1$

String transformation = "SELECT pg_catalog.getOid(UID) as oid, name as conname, lower(left(Type, 1)) as contype, " //$NON-NLS-1$
+ "null as consrc, " //$NON-NLS-1$
+ "pg_catalog.getOid(TableUID) as conrelid, pg_catalog.getOid(RefTableUID) as confrelid, " //$NON-NLS-1$
+ "ColPositions as conkey " + //$NON-NLS-1$
"FROM Sys.Keys WHERE Type in ('Primary', 'Unique', 'Foreign')"; //$NON-NLS-1$
t.setSelectTransformation(transformation);
return t;

}

private void add_pg_prepared_xacts() {
Table t = createView("pg_prepared_xacts"); //$NON-NLS-1$
//xid
addColumn("transaction", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
Expand Down Expand Up @@ -308,7 +333,12 @@ private Table add_pg_class() {
addColumn("relhasrules", DataTypeManager.DefaultDataTypes.BOOLEAN, t); //$NON-NLS-1$

// True if we generate an OID for each row of the relation
addColumn("relhasoids", DataTypeManager.DefaultDataTypes.BOOLEAN, t); //$NON-NLS-1$
addColumn("relhasoids", DataTypeManager.DefaultDataTypes.BOOLEAN, t); //$NON-NLS-1$

//additional column not present in pg metadata - for column metadata query
addColumn("relnspname", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$

addColumn("reloptions", DataTypeManager.getDataTypeName(DataTypeManager.getArrayType(DataTypeManager.DefaultDataClasses.STRING)), t); //$NON-NLS-1$

addPrimaryKey("pk_pg_class", Arrays.asList("oid"), t); //$NON-NLS-1$ //$NON-NLS-2$

Expand All @@ -320,7 +350,9 @@ private Table add_pg_class() {
"convert(0, float) as reltuples, " + //$NON-NLS-1$
"0 as relpages, " + //$NON-NLS-1$
"false as relhasrules, " + //$NON-NLS-1$
"false as relhasoids " + //$NON-NLS-1$
"false as relhasoids, " + //$NON-NLS-1$
"t1.SchemaName as relnspname, " + //$NON-NLS-1$
"null as reloptions " + //$NON-NLS-1$
"FROM SYS.Tables t1 UNION ALL SELECT pg_catalog.getOid(t1.uid) as oid, t1.name as relname, " + //$NON-NLS-1$
"(SELECT pg_catalog.getOid(uid) FROM SYS.Schemas WHERE Name = t1.SchemaName) as relnamespace, " + //$NON-NLS-1$
"convert('i', char) as relkind," + //$NON-NLS-1$
Expand All @@ -329,7 +361,9 @@ private Table add_pg_class() {
"convert(0, float) as reltuples, " + //$NON-NLS-1$
"0 as relpages, " + //$NON-NLS-1$
"false as relhasrules, " + //$NON-NLS-1$
"false as relhasoids " + //$NON-NLS-1$
"false as relhasoids, " + //$NON-NLS-1$
"t1.SchemaName as relnspname, " + //$NON-NLS-1$
"null as reloptions " + //$NON-NLS-1$
"FROM SYS.Keys t1 WHERE t1.type in ('Primary', 'Unique', 'Index')"; //$NON-NLS-1$
t.setSelectTransformation(transformation);
t.setMaterialized(true);
Expand Down Expand Up @@ -518,13 +552,14 @@ private Table add_pg_type() {
addColumn("typrelid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
addColumn("typelem", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
addColumn("typinput", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
addColumn("typdefault", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$

//non-pg column to associate the teiid type name - this is expected to be unique.
//aliases are handled by matpg_datatype
addColumn("teiid_name", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$

String transformation =
"select oid, typname, (SELECT pg_catalog.getOid(uid) FROM SYS.Schemas where Name = 'SYS') as typnamespace, typlen, typtype, false as typnotnull, typbasetype, typtypmod, cast(',' as char) as typdelim, typrelid, typelem, null as typeinput, teiid_name from texttable('" + //$NON-NLS-1$
"select oid, typname, (SELECT pg_catalog.getOid(uid) FROM SYS.Schemas where Name = 'SYS') as typnamespace, typlen, typtype, false as typnotnull, typbasetype, typtypmod, cast(',' as char) as typdelim, typrelid, typelem, null as typeinput, null as typdefault, teiid_name from texttable('" + //$NON-NLS-1$
"16,bool,1,b,0,-1,0,0,boolean\n" + //$NON-NLS-1$
"17,bytea,-1,b,0,-1,0,0,blob\n" + //$NON-NLS-1$
"1043,varchar,-1,b,0,-1,0,0,string\n" + //$NON-NLS-1$
Expand Down Expand Up @@ -771,6 +806,15 @@ public static String currentSchema(org.teiid.CommandContext cc) {
return "SYS"; //$NON-NLS-1$
}

private static Map<String, String> TypeNameMap = new HashMap<String, String>();
static {
TypeNameMap.put("int2", "smallint");
TypeNameMap.put("int4", "integer");
TypeNameMap.put("int8", "bigint");
TypeNameMap.put("float4", "real");
TypeNameMap.put("float8", "double precision");
}

public static String formatType(org.teiid.CommandContext cc, int oid, int typmod) throws SQLException {
Connection c = cc.getConnection();
try {
Expand All @@ -780,13 +824,24 @@ public static String formatType(org.teiid.CommandContext cc, int oid, int typmod
ResultSet rs = ps.getResultSet();
if (rs.next()) {
String name = rs.getString(1);
boolean isArray = name.startsWith("_"); //$NON-NLS-1$
if (isArray) {
name = name.substring(1);
}
String otherName = TypeNameMap.get(name);
if (otherName != null) {
name = otherName;
}
if (typmod > 4) {
if (name.equals("numeric")) { //$NON-NLS-1$
name += "("+((typmod-4)>>16)+","+((typmod-4)&0xffff)+")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else if (name.equals("bpchar") || name.equals("varchar")) { //$NON-NLS-1$ //$NON-NLS-2$
name += "("+(typmod-4)+")"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
if (isArray) {
name += "[]"; //$NON-NLS-1$
}
return name;
}
return "???"; //$NON-NLS-1$
Expand All @@ -810,5 +865,17 @@ public static BlobType asBinary2(GeometryType geom, String encoding) throws Func
return GeometryFunctionMethods.asBlob(geom, encoding);
}

public static boolean pg_table_is_visible(int oid) throws FunctionExecutionException {
return true;
}

public static String pg_get_constraintdef(int oid, boolean pretty) throws FunctionExecutionException {
return "";
}

public static boolean pg_type_is_visible(int oid) throws FunctionExecutionException {
return true;
}

}
}
11 changes: 9 additions & 2 deletions runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
Expand Up @@ -69,6 +69,7 @@
import org.teiid.net.socket.SocketServerConnection;
import org.teiid.odbc.ODBCClientRemote.CursorDirection;
import org.teiid.odbc.PGUtil.PgColInfo;
import org.teiid.query.sql.symbol.Constant;
import org.teiid.runtime.RuntimePlugin;
import org.teiid.security.GSSResult;
import org.teiid.transport.LocalServerConnection;
Expand All @@ -84,7 +85,8 @@
*/
public class ODBCServerRemoteImpl implements ODBCServerRemote {

private static final boolean HONOR_DECLARE_FETCH_TXN = PropertiesUtils.getBooleanProperty(System.getProperties(), "org.teiid.honorDeclareFetchTxn", false); //$NON-NLS-1$
private static final boolean HONOR_DECLARE_FETCH_TXN = PropertiesUtils.getBooleanProperty(System.getProperties(), "org.teiid.honorDeclareFetchTxn", false); //$NON-NLS-1$
private static final String POSTGRESQL_VERSION = System.getProperties().getProperty("org.teiid.pgVersion"); //$NON-NLS-1$

public static final String CONNECTION_PROPERTY_PREFIX = "connection."; //$NON-NLS-1$
private static final String UNNAMED = ""; //$NON-NLS-1$
Expand Down Expand Up @@ -720,6 +722,7 @@ private String fixSQL(String sql) {
if (modified != null && !modified.equals(sql)) {
LogManager.logDetail(LogConstants.CTX_ODBC, "Modified Query:", modified); //$NON-NLS-1$
}
System.out.println(modified);
return modified;
}

Expand Down Expand Up @@ -764,7 +767,11 @@ else if ((m = fkPattern.matcher(modified)).matches()){
return baseQuery + "FKTABLE_NAME = " + m.group(15)+" and FKTABLE_SCHEM = "+m.group(16);//$NON-NLS-1$ //$NON-NLS-2$
}
else if (modified.equalsIgnoreCase("select version()")) { //$NON-NLS-1$
return "SELECT 'Teiid "+ApplicationInfo.getInstance().getReleaseNumber()+"'"; //$NON-NLS-1$ //$NON-NLS-2$
String version = POSTGRESQL_VERSION;
if (version == null) {
version = "Teiid "+ApplicationInfo.getInstance().getReleaseNumber(); //$NON-NLS-1$
}
return "SELECT " + new Constant(version); //$NON-NLS-1$
}
else if (modified.startsWith("SELECT name FROM master..sysdatabases")) { //$NON-NLS-1$
return "SELECT 'Teiid'"; //$NON-NLS-1$
Expand Down

0 comments on commit 1709e99

Please sign in to comment.