use of com.github.drinkjava2.functionstest.entitynet.entities.Address in project jSqlBox by drinkjava2.
the class UsuageAndSpeedTest method nXxxStyle.
@Test
public void nXxxStyle() {
SqlBoxContext ctx = new SqlBoxContext(dataSource);
for (int i = 0; i < REPEAT_TIMES; i++) {
ctx.nExecute("insert into users (name,address) values(?,?)", "Sam", "Canada");
ctx.nExecute("update users set name=?, address=?", "Tom", "China");
Assert.assertEquals(1L, ctx.nQueryForObject("select count(*) from users where name=? and address=?", "Tom", "China"));
ctx.nExecute("delete from users where name=? or address=?", "Tom", "China");
}
}
use of com.github.drinkjava2.functionstest.entitynet.entities.Address in project jSqlBox by drinkjava2.
the class UsuageAndSpeedTest method dbUtilsNoConnMethod.
@Test
public void dbUtilsNoConnMethod() {
SqlBoxContext ctx = new SqlBoxContext(dataSource);
for (int i = 0; i < REPEAT_TIMES; i++) {
try {
ctx.execute("insert into users (name,address) values(?,?)", "Sam", "Canada");
ctx.execute("update users set name=?, address=?", "Tom", "China");
Assert.assertEquals(1L, ctx.queryForObject("select count(*) from users where name=? and address=?", "Tom", "China"));
ctx.execute("delete from users where name=? or address=?", "Tom", "China");
} catch (SQLException e) {
e.printStackTrace();
}
}
}
use of com.github.drinkjava2.functionstest.entitynet.entities.Address in project jSqlBox by drinkjava2.
the class UsuageAndSpeedTest method tXxxStyle.
@Test
public void tXxxStyle() {
SqlBoxContext ctx2 = new SqlBoxContext(dataSource);
Map<String, Object> params = new HashMap<String, Object>();
for (int i = 0; i < REPEAT_TIMES; i++) {
UserAR sam = new UserAR("Sam", "Canada");
UserAR tom = new UserAR("Tom", "China");
params.put("user", sam);
ctx2.tExecute("insert into users (name, address) values(#{user.name},:user.address)", params);
params.put("user", tom);
ctx2.tExecute("update users set name=#{user.name}, address=:user.address", params);
params.clear();
params.put("name", "Tom");
params.put("addr", "China");
Assert.assertEquals(1L, ctx2.tQueryForObject("select count(*) from users where name=#{name} and address=:addr", params));
params.put("u", tom);
ctx2.tExecute("delete from users where name=:u.name or address=#{u.address}", params);
}
}
use of com.github.drinkjava2.functionstest.entitynet.entities.Address in project jSqlBox by drinkjava2.
the class UsuageAndSpeedTest method iXxxStyle2.
@Test
public void iXxxStyle2() {
SqlBoxContext ctx = new SqlBoxContext(dataSource);
for (int i = 0; i < REPEAT_TIMES; i++) {
//
ctx.iExecute(//
"insert into ", //
UserAR.USER, //
" ( ", //
UserAR.NAME, //
",", //
param0("Sam"), //
UserAR.ADDRESS, //
" ", //
param("Canada"), ") ", valuesQuesions());
param0("Tom", "China");
ctx.iExecute("update users set name=?,address=?");
Assert.assertEquals(1L, ctx.iQueryForObject("select count(*) from users where name=? and address=?" + param0("Tom", "China")));
ctx.iExecute("delete from users where name=", question0("Tom"), " or address=", question("China"));
}
}
use of com.github.drinkjava2.functionstest.entitynet.entities.Address in project jSqlBox by drinkjava2.
the class UsuageAndSpeedTest method iXxxStyle.
@Test
public void iXxxStyle() {
SqlBoxContext ctx = new SqlBoxContext(dataSource);
for (int i = 0; i < REPEAT_TIMES; i++) {
//
ctx.iExecute(//
"insert into users (", //
" name ,", //
param0("Sam"), //
" address ", //
param("Canada"), ") ", valuesQuesions());
param0("Tom", "China");
ctx.iExecute("update users set name=?,address=?");
Assert.assertEquals(1L, ctx.iQueryForObject("select count(*) from users where name=? and address=?" + param0("Tom", "China")));
ctx.iExecute("delete from users where name=", question0("Tom"), " or address=", question("China"));
}
}
Aggregations