Search in sources :

Example 26 with DalHints

use of com.ctrip.platform.dal.dao.DalHints in project dal by ctripcorp.

the class SqlServerDatabaseInitializer method tearDownAfterClass.

public static void tearDownAfterClass() throws Exception {
    DalHints hints = new DalHints();
    StatementParameters parameters = new StatementParameters();
    String[] sqls = new String[] { DROP_TABLE_SQL, DROP_SP_WITHOUT_OUT_PARAM, DROP_SP_WITH_OUT_PARAM, DROP_SP_WITH_IN_OUT_PARAM, DROP_SP_WITH_INTERMEDIATE_RESULT };
    for (int i = 0; i < sqls.length; i++) {
        client.update(sqls[i], parameters, hints);
    }
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) StatementParameters(com.ctrip.platform.dal.dao.StatementParameters)

Example 27 with DalHints

use of com.ctrip.platform.dal.dao.DalHints in project dal by ctripcorp.

the class SqlServerDatabaseInitializer method setUpBeforeClass.

public static void setUpBeforeClass() throws Exception {
    DalHints hints = new DalHints();
    StatementParameters parameters = new StatementParameters();
    String[] sqls = new String[] { DROP_TABLE_SQL, CREATE_TABLE_SQL, DROP_SP_WITHOUT_OUT_PARAM, CREATE_SP_WITHOUT_OUT_PARAM, DROP_SP_WITH_OUT_PARAM, CREATE_SP_WITH_OUT_PARAM, DROP_SP_WITH_IN_OUT_PARAM, CREATE_SP_WITH_IN_OUT_PARAM, DROP_SP_WITH_INTERMEDIATE_RESULT, CREATE_SP_WITH_INTERMEDIATE_RESULT };
    for (int i = 0; i < sqls.length; i++) {
        client.update(sqls[i], parameters, hints);
    }
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) StatementParameters(com.ctrip.platform.dal.dao.StatementParameters)

Example 28 with DalHints

use of com.ctrip.platform.dal.dao.DalHints in project dal by ctripcorp.

the class OracleTestInitializer method tearDown.

@After
public static void tearDown() throws Exception {
    String sql = "DELETE FROM " + TABLE_NAME;
    StatementParameters parameters = new StatementParameters();
    DalHints hints = new DalHints();
    client.update(sql, parameters, hints);
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) StatementParameters(com.ctrip.platform.dal.dao.StatementParameters) After(org.junit.After)

Example 29 with DalHints

use of com.ctrip.platform.dal.dao.DalHints in project dal by ctripcorp.

the class OracleTestInitializer method tearDownAfterClass.

@AfterClass
public static void tearDownAfterClass() throws Exception {
    DalHints hints = new DalHints();
    String[] sqls = new String[] { DROP_TABLE_SEQ, DROP_TABLE_TRIG, DROP_TABLE_SQL };
    client.batchUpdate(sqls, hints);
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) AfterClass(org.junit.AfterClass)

Example 30 with DalHints

use of com.ctrip.platform.dal.dao.DalHints in project dal by ctripcorp.

the class DalQueryDaoTestStub method prepareData.

public static void prepareData(String dbName) throws Exception {
    String insertSql = "INSERT INTO " + TABLE_NAME + "(quantity,type,address)" + " VALUES(?, ?, ?)";
    StatementParameters[] parameterList = new StatementParameters[ROW_COUNT];
    Random random = new Random();
    for (int i = 0; i < ROW_COUNT; i++) {
        StatementParameters param = new StatementParameters();
        int quantity = random.nextInt(5);
        int type = random.nextInt(3);
        param.set(1, Types.INTEGER, 10 + quantity);
        param.set(2, Types.SMALLINT, type);
        param.set(3, Types.VARCHAR, "SZ INFO" + "_" + i % 100 + "#");
        parameterList[i] = param;
    }
    DalClientFactory.getClient(dbName).batchUpdate(insertSql, parameterList, new DalHints());
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) Random(java.util.Random) StatementParameters(com.ctrip.platform.dal.dao.StatementParameters)

Aggregations

DalHints (com.ctrip.platform.dal.dao.DalHints)772 Test (org.junit.Test)532 StatementParameters (com.ctrip.platform.dal.dao.StatementParameters)317 SQLException (java.sql.SQLException)298 ArrayList (java.util.ArrayList)132 ClientTestModel (test.com.ctrip.platform.dal.dao.unitbase.ClientTestModel)61 List (java.util.List)48 KeyHolder (com.ctrip.platform.dal.dao.KeyHolder)45 FreeSelectSqlBuilder (com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder)39 Future (java.util.concurrent.Future)32 DalTableDao (com.ctrip.platform.dal.dao.DalTableDao)29 SelectionContext (com.ctrip.platform.dal.dao.configure.SelectionContext)27 DalDefaultJpaParser (com.ctrip.platform.dal.dao.helper.DalDefaultJpaParser)27 DataBase (com.ctrip.platform.dal.dao.configure.DataBase)26 BeforeClass (org.junit.BeforeClass)26 AfterClass (org.junit.AfterClass)25 HashMap (java.util.HashMap)23 FreeUpdateSqlBuilder (com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder)20 DalClient (com.ctrip.platform.dal.dao.DalClient)18 BatchUpdateTask (com.ctrip.platform.dal.dao.task.BatchUpdateTask)18