use of com.haulmont.bali.db.QueryRunner in project cuba by cuba-platform.
the class DbUpdaterEngine method markScript.
protected void markScript(String name, boolean init) {
log.trace("Marking script as executed: {}", name);
QueryRunner runner = new QueryRunner(getDataSource());
try {
runner.update("insert into SYS_DB_CHANGELOG (SCRIPT_NAME, IS_INIT) values (?, ?)", new Object[] { name, init ? 1 : 0 });
} catch (SQLException e) {
throw new RuntimeException(ERROR + "Error updating SYS_DB_CHANGELOG", e);
}
}
use of com.haulmont.bali.db.QueryRunner in project cuba by cuba-platform.
the class IdentityTest method setUp.
@Before
public void setUp() throws Exception {
QueryRunner runner = new QueryRunner(cont.persistence().getDataSource());
runner.update("delete from TEST_IDENTITY");
metadata = cont.metadata();
persistence = cont.persistence();
}
use of com.haulmont.bali.db.QueryRunner in project cuba by cuba-platform.
the class IdentityUuidTest method setUp.
@Before
public void setUp() throws Exception {
QueryRunner runner = new QueryRunner(cont.persistence().getDataSource());
runner.update("delete from TEST_IDENTITY_UUID");
metadata = cont.metadata();
persistence = cont.persistence();
}
use of com.haulmont.bali.db.QueryRunner in project cuba by cuba-platform.
the class EntityLogTest method cleanup.
private void cleanup() throws SQLException {
QueryRunner runner = new QueryRunner(cont.persistence().getDataSource());
runner.update("delete from SEC_LOGGED_ATTR");
runner.update("delete from SEC_LOGGED_ENTITY");
}
use of com.haulmont.bali.db.QueryRunner in project cuba by cuba-platform.
the class DataManagerDistinctResultsTest method tearDown.
@After
public void tearDown() throws Exception {
Transaction tx = cont.persistence().createTransaction();
try {
QueryRunner runner = new QueryRunner(cont.persistence().getDataSource());
try {
String sql = "delete from SEC_USER_ROLE where ROLE_ID = '" + role1Id.toString() + "'";
runner.update(sql);
sql = "delete from SEC_USER_ROLE where ROLE_ID = '" + role2Id.toString() + "'";
runner.update(sql);
sql = "delete from SEC_ROLE where ID = '" + role1Id.toString() + "'";
runner.update(sql);
sql = "delete from SEC_ROLE where ID = '" + role2Id.toString() + "'";
runner.update(sql);
sql = "delete from SEC_USER where GROUP_ID = '" + groupId.toString() + "'";
runner.update(sql);
sql = "delete from SEC_GROUP where ID = '" + groupId.toString() + "'";
runner.update(sql);
} catch (SQLException e) {
e.printStackTrace();
}
tx.commit();
} finally {
tx.end();
}
}
Aggregations