Search in sources :

Example 36 with ISqlTemplate

use of org.jumpmind.db.sql.ISqlTemplate in project symmetric-ds by JumpMind.

the class DefaultDatabaseWriter method bindVariables.

@Override
protected void bindVariables(Map<String, Object> variables) {
    super.bindVariables(variables);
    ISqlTemplate template = platform.getSqlTemplate();
    Class<?> templateClass = template.getClass();
    if (templateClass.getSimpleName().equals("JdbcSqlTemplate")) {
        try {
            Method method = templateClass.getMethod("getDataSource");
            variables.put("DATASOURCE", method.invoke(template));
        } catch (Exception e) {
            log.warn("Had trouble looking up the datasource used by the sql template", e);
        }
    }
}
Also used : ISqlTemplate(org.jumpmind.db.sql.ISqlTemplate) Method(java.lang.reflect.Method) SqlException(org.jumpmind.db.sql.SqlException)

Aggregations

ISqlTemplate (org.jumpmind.db.sql.ISqlTemplate)36 Row (org.jumpmind.db.sql.Row)8 Test (org.junit.Test)8 Date (java.util.Date)6 IDatabasePlatform (org.jumpmind.db.platform.IDatabasePlatform)5 ISqlTransaction (org.jumpmind.db.sql.ISqlTransaction)5 DataGap (org.jumpmind.symmetric.model.DataGap)5 Table (org.jumpmind.db.model.Table)4 Map (java.util.Map)3 Column (org.jumpmind.db.model.Column)3 SqlException (org.jumpmind.db.sql.SqlException)3 DbExport (org.jumpmind.symmetric.io.data.DbExport)3 AbstractServiceTest (org.jumpmind.symmetric.service.impl.AbstractServiceTest)3 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 Database (org.jumpmind.db.model.Database)2 DmlStatement (org.jumpmind.db.sql.DmlStatement)2 ISqlRowMapper (org.jumpmind.db.sql.ISqlRowMapper)2 IoException (org.jumpmind.exception.IoException)2 SymmetricException (org.jumpmind.symmetric.SymmetricException)2