本文整理汇总了Java中org.javalite.activejdbc.Base类的典型用法代码示例。如果您正苦于以下问题:Java Base类的具体用法?Java Base怎么用?Java Base使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Base类属于org.javalite.activejdbc包,在下文中一共展示了Base类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openConnection
import org.javalite.activejdbc.Base; //导入依赖的package包/类
public static void openConnection() {
if (!Base.hasConnection()) {
String user = dbUser != null ? dbUser : "";
String password = dbPassword != null ? dbPassword : "";
switch (dbDriver) {
case MYSQL:
Base.open(com.mysql.jdbc.Driver.class.getName(), dbUrl, user, password);
break;
case H2:
Base.open(org.h2.Driver.class.getName(), dbUrl, user, password);
break;
default:
throw new IllegalArgumentException("Unknown database driver");
}
}
}
示例2: gunban
import org.javalite.activejdbc.Base; //导入依赖的package包/类
@Override
public boolean gunban(String player) {
if (!Base.hasConnection()) {
Base.open(bonecp);
}
return SqlPlayerBanEntry.delete("banned = ? AND server = '(GLOBAL)'", player) > 0;
}
示例3: resetOracle
import org.javalite.activejdbc.Base; //导入依赖的package包/类
static void resetOracle(String[] statements) throws SQLException {
dropTriggers();
dropSequences();
dropTables();
for (String statement : statements) {
if (!Util.blank(statement)) {
Statement st = null;
try {
st = Base.connection().createStatement();
st.executeUpdate(statement);
} catch(SQLException e) {
System.out.println("Problem statement: " + statement);
throw e;
} finally {
closeQuietly(st);
}
}
}
}
示例4: 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();
}
}
示例5: initialize
import org.javalite.activejdbc.Base; //导入依赖的package包/类
@Override
public void initialize(UimaContext context)
throws ResourceInitializationException {
super.initialize(context);
Base.open("com.mysql.jdbc.Driver", "jdbc:mysql://" + db_connection[0]
+ "/" + db_connection[1] + "", db_connection[2],
db_connection[3]);
processed = 0;
inserted = 0;
}
示例6: destroy
import org.javalite.activejdbc.Base; //导入依赖的package包/类
@Override
public void destroy() {
try {
Base.close();
} catch (Exception e) {
LOG.warn("could not close conn", e);
}
}
示例7: reConnect
import org.javalite.activejdbc.Base; //导入依赖的package包/类
public static void reConnect(String[] db_connection) {
try {
Base.close();
} catch (Exception e) {// nope
}
connect(db_connection);
}
示例8: open
import org.javalite.activejdbc.Base; //导入依赖的package包/类
public void open() {
String driver = globalProps.getProperty("jdbcClass");
String jdbcUrl = globalProps.getProperty("jdbcUrl");
String user = globalProps.getProperty("jdbcUser");
String pass = globalProps.getProperty("jdbcPwd");
Base.open(driver, jdbcUrl, user, pass);
}
示例9: setup
import org.javalite.activejdbc.Base; //导入依赖的package包/类
private void setup()
{
/* Create a database connection for the runnables to use. */
ConfigurationManager configurationManager = ConfigurationManager.getSharedManager();
Base.open("org.postgresql.Driver", configurationManager.getPostgresURI(), configurationManager.getPostgresUsername(), configurationManager.getPostgresPassword());
}
示例10: unban
import org.javalite.activejdbc.Base; //导入依赖的package包/类
@Override
public boolean unban(String player, String server) {
if (!Base.hasConnection()) {
Base.open(bonecp);
}
return SqlPlayerBanEntry.delete("banned = ? AND server = ?", player, server) > 0;
}
示例11: unbanIP
import org.javalite.activejdbc.Base; //导入依赖的package包/类
@Override
public boolean unbanIP(String ip, String server) {
if (!Base.hasConnection()) {
Base.open(bonecp);
}
return SqlIPBanEntry.delete("banned = ? AND server = ?", ip, server) > 0;
}
示例12: gunbanIP
import org.javalite.activejdbc.Base; //导入依赖的package包/类
@Override
public boolean gunbanIP(String ip) {
if (!Base.hasConnection()) {
Base.open(bonecp);
}
return SqlIPBanEntry.delete("banned = ? AND server = '(GLOBAL')", ip) > 0;
}
示例13: getBanList
import org.javalite.activejdbc.Base; //导入依赖的package包/类
@Override
public Table<String, String, BanEntry> getBanList() {
if (!Base.hasConnection()) {
Base.open(bonecp);
}
Table<String, String, BanEntry> returnval = HashBasedTable.create();
List<SqlPlayerBanEntry> entries = SqlPlayerBanEntry.findAll();
for (SqlPlayerBanEntry entry : entries) {
BanEntry beentry = entry.toBanEntry();
returnval.put(beentry.getBanned(), beentry.getServer(), beentry);
}
return returnval;
}
示例14: getIPBanList
import org.javalite.activejdbc.Base; //导入依赖的package包/类
@Override
public Table<String, String, BanEntry> getIPBanList() {
if (!Base.hasConnection()) {
Base.open(bonecp);
}
Table<String, String, BanEntry> returnval = HashBasedTable.create();
List<SqlIPBanEntry> entries = SqlIPBanEntry.findAll();
for (SqlIPBanEntry entry : entries) {
BanEntry beentry = entry.toBanEntry();
returnval.put(beentry.getBanned(), beentry.getServer(), beentry);
}
return returnval;
}
示例15: isBanned
import org.javalite.activejdbc.Base; //导入依赖的package包/类
@Override
public BanEntry isBanned(String player, String server) {
if (!Base.hasConnection()) {
Base.open(bonecp);
}
List<SqlPlayerBanEntry> entries = SqlPlayerBanEntry.where("banned = ? AND server = ?", player, server);
if (entries.size() < 1) {
return null;
}
return entries.get(0).toBanEntry();
}