本文整理汇总了Java中org.javalite.activejdbc.Base.exec方法的典型用法代码示例。如果您正苦于以下问题:Java Base.exec方法的具体用法?Java Base.exec怎么用?Java Base.exec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.javalite.activejdbc.Base
的用法示例。
在下文中一共展示了Base.exec方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: markMessagesAsRead
import org.javalite.activejdbc.Base; //导入方法依赖的package包/类
public static String markMessagesAsRead(Integer userId) {
// Fetch fetch the user unreadmessage list
String joinSQL = fetchUserMessageList(userId, userId, null, null, null, false).toSql(false);
joinSQL = joinSQL.substring(0,joinSQL.length()-1); // remove the semicolon;
StringBuilder s = new StringBuilder();
s.append("update comment a\n");
s.append("join (" + joinSQL + ") k \n");
s.append("on a.id = k.id \n");
s.append("set a.read = 1 \n");
String updateSQL = s.toString();
Base.exec(updateSQL);
return "success";
}
示例2: before
import org.javalite.activejdbc.Base; //导入方法依赖的package包/类
@Before
public void before() {
Base.open("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/activejdbc", "root", "[email protected]");
Base.exec("delete from people");
for (int i = 0; i < 100; i++) {
Person.create("name", "name: " + i, "last_name", "last_name: " + i, "dob", "1935-12-06").saveIt();
}
}
示例3: f_shouldFindRecordsFromPrevious_NOT_Rolledback_Transaction
import org.javalite.activejdbc.Base; //导入方法依赖的package包/类
@Test
public void f_shouldFindRecordsFromPrevious_NOT_Rolledback_Transaction(){
a(Base.count("patients")).shouldBeEqual(1);
//lets cleanup after ourselves just in case
setRollback(false);
Base.exec("delete from patients");
}
示例4: a_clean
import org.javalite.activejdbc.Base; //导入方法依赖的package包/类
@Test
public void a_clean(){
setRollback(false);
Base.exec("delete from patients");
}
示例5: c_shouldRollBackTransactionByDefault
import org.javalite.activejdbc.Base; //导入方法依赖的package包/类
@Test
public void c_shouldRollBackTransactionByDefault(){
Base.exec("insert into patients (first_name, last_name) values ('Billie', 'Holiday')");
}
示例6: e_should_NOT_RollBackTransaction
import org.javalite.activejdbc.Base; //导入方法依赖的package包/类
@Test
public void e_should_NOT_RollBackTransaction(){
setRollback(false); // here, we are leaving data in DB for the next test to find (no rollback at the end of test)
Base.exec("insert into patients (first_name, last_name) values ('Billie', 'Holiday')");
}