use of org.teiid.translator.jdbc.oracle.LeftOrRightFunctionModifier in project teiid by teiid.
the class DerbyExecutionFactory method start.
@Override
public void start() throws TranslatorException {
super.start();
// additional derby functions
registerFunctionModifier(SourceSystemFunctions.TIMESTAMPADD, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.TIMESTAMPDIFF, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.LEFT, new LeftOrRightFunctionModifier(getLanguageFactory()));
// overrides of db2 functions
registerFunctionModifier(SourceSystemFunctions.CONCAT, new EscapeSyntaxModifier());
}
use of org.teiid.translator.jdbc.oracle.LeftOrRightFunctionModifier in project teiid by teiid.
the class PostgreSQLExecutionFactory method initCapabilities.
@Override
public void initCapabilities(Connection connection) throws TranslatorException {
super.initCapabilities(connection);
if (getVersion().compareTo(NINE_0) <= 0) {
registerFunctionModifier(SourceSystemFunctions.LEFT, new LeftOrRightFunctionModifier(getLanguageFactory()));
}
if (this.postGisVersion.compareTo(Version.DEFAULT_VERSION) != 0 || connection == null) {
return;
}
Statement s = null;
ResultSet rs = null;
Savepoint savepoint = null;
try {
if (!connection.getAutoCommit()) {
// we need to use a savepoint as an exception will invalidate the connection
savepoint = connection.setSavepoint();
}
s = connection.createStatement();
// $NON-NLS-1$
rs = s.executeQuery("SELECT PostGIS_Full_Version()");
rs.next();
String versionInfo = rs.getString(1);
if (versionInfo != null) {
if (versionInfo.contains("PROJ=")) {
// $NON-NLS-1$
projSupported = true;
}
// $NON-NLS-1$
int index = versionInfo.indexOf("POSTGIS=");
if (index > -1) {
String version = versionInfo.substring(index + 9, versionInfo.indexOf('"', index + 9));
this.setPostGisVersion(version);
}
}
} catch (SQLException e) {
// $NON-NLS-1$
LogManager.logDetail(LogConstants.CTX_CONNECTOR, e, "Could not determine PostGIS version");
} finally {
if (savepoint != null) {
try {
connection.rollback(savepoint);
} catch (SQLException e) {
}
}
try {
if (rs != null) {
rs.close();
}
} catch (SQLException e) {
}
try {
if (s != null) {
s.close();
}
} catch (SQLException e) {
}
}
}
Aggregations