Search in sources :

Example 1 with SqlTemplateSettings

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;
}
Also used : LogSqlBuilder(org.jumpmind.db.sql.LogSqlBuilder) SqlTemplateSettings(org.jumpmind.db.sql.SqlTemplateSettings)

Example 2 with SqlTemplateSettings

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);
}
Also used : SqlTemplateSettings(org.jumpmind.db.sql.SqlTemplateSettings) TypedProperties(org.jumpmind.properties.TypedProperties) File(java.io.File) ResettableBasicDataSource(org.jumpmind.db.util.ResettableBasicDataSource) DataSource(javax.sql.DataSource)

Example 3 with SqlTemplateSettings

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);
}
Also used : SqlTemplateSettings(org.jumpmind.db.sql.SqlTemplateSettings) EnvironmentSpecificProperties(org.jumpmind.properties.EnvironmentSpecificProperties) File(java.io.File)

Aggregations

SqlTemplateSettings (org.jumpmind.db.sql.SqlTemplateSettings)3 File (java.io.File)2 DataSource (javax.sql.DataSource)1 LogSqlBuilder (org.jumpmind.db.sql.LogSqlBuilder)1 ResettableBasicDataSource (org.jumpmind.db.util.ResettableBasicDataSource)1 EnvironmentSpecificProperties (org.jumpmind.properties.EnvironmentSpecificProperties)1 TypedProperties (org.jumpmind.properties.TypedProperties)1