use of org.jumpmind.db.sql.SqlTemplateSettings in project symmetric-ds by JumpMind.
the class ClientSymmetricEngine method createSqlTemplateSettings.
protected static SqlTemplateSettings createSqlTemplateSettings(TypedProperties properties) {
SqlTemplateSettings settings = new SqlTemplateSettings();
settings.setFetchSize(properties.getInt(ParameterConstants.DB_FETCH_SIZE, 1000));
settings.setQueryTimeout(properties.getInt(ParameterConstants.DB_QUERY_TIMEOUT_SECS, 300));
settings.setBatchSize(properties.getInt(ParameterConstants.JDBC_EXECUTE_BATCH_SIZE, 100));
settings.setOverrideIsolationLevel(properties.getInt(ParameterConstants.JDBC_ISOLATION_LEVEL, -1));
settings.setReadStringsAsBytes(properties.is(ParameterConstants.JDBC_READ_STRINGS_AS_BYTES, false));
LogSqlBuilder logSqlBuilder = new LogSqlBuilder();
logSqlBuilder.setLogSlowSqlThresholdMillis(properties.getInt(ParameterConstants.LOG_SLOW_SQL_THRESHOLD_MILLIS, 20000));
logSqlBuilder.setLogSqlParametersInline(properties.is(ParameterConstants.LOG_SQL_PARAMETERS_INLINE, true));
settings.setLogSqlBuilder(logSqlBuilder);
if (settings.getOverrideIsolationLevel() >= 0) {
log.info("Overriding isolation level to " + settings.getOverrideIsolationLevel());
}
return settings;
}
use of org.jumpmind.db.sql.SqlTemplateSettings in project symmetric-ds by JumpMind.
the class SqlPersistenceManagerTest method createDatabasePlatform.
public static IDatabasePlatform createDatabasePlatform() throws Exception {
final String DB_DIR = "build/dbs";
File dir = new File(DB_DIR);
if (dir.exists()) {
FileUtils.deleteDirectory(new File(DB_DIR));
}
TypedProperties properties = new TypedProperties();
properties.setProperty(BasicDataSourcePropertyConstants.DB_POOL_DRIVER, "org.h2.Driver");
properties.setProperty(BasicDataSourcePropertyConstants.DB_POOL_URL, "jdbc:h2:file:" + DB_DIR + "/testdb");
properties.setProperty(BasicDataSourcePropertyConstants.DB_POOL_USER, "jumpmind");
properties.setProperty(BasicDataSourcePropertyConstants.DB_POOL_PASSWORD, "jumpmind");
DataSource ds = BasicDataSourceFactory.create(properties);
return JdbcDatabasePlatformFactory.createNewPlatformInstance(ds, new SqlTemplateSettings(), false, false);
}
use of org.jumpmind.db.sql.SqlTemplateSettings in project symmetric-ds by JumpMind.
the class DbTestUtils method createDatabasePlatform.
public static IDatabasePlatform createDatabasePlatform(String name) throws Exception {
File f = new File(String.format("target/%sdbs", name));
FileUtils.deleteDirectory(f);
f.mkdir();
EnvironmentSpecificProperties properties = getEnvironmentSpecificProperties(name);
return JdbcDatabasePlatformFactory.createNewPlatformInstance(BasicDataSourceFactory.create(properties, SecurityServiceFactory.create()), new SqlTemplateSettings(), true, false);
}
Aggregations