当前位置: 首页>>代码示例>>Java>>正文


Java Base.open方法代码示例

本文整理汇总了Java中org.javalite.activejdbc.Base.open方法的典型用法代码示例。如果您正苦于以下问题:Java Base.open方法的具体用法?Java Base.open怎么用?Java Base.open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.javalite.activejdbc.Base的用法示例。


在下文中一共展示了Base.open方法的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");
        }
    }
}
 
开发者ID:autoschool,项目名称:splinter,代码行数:17,代码来源:DatabaseProvider.java

示例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;
}
 
开发者ID:roblabla,项目名称:BungeeBan,代码行数:8,代码来源:MySQLBanStore.java

示例3: 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();
    }

}
 
开发者ID:javalite,项目名称:activejdbc-redis,代码行数:10,代码来源:RedisSpec.java

示例4: 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;
}
 
开发者ID:BlueBrain,项目名称:bluima,代码行数:11,代码来源:PubmedDatabaseAE.java

示例5: 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);
}
 
开发者ID:zhoushineyoung,项目名称:zookeeper-edit,代码行数:8,代码来源:Dao.java

示例6: 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());
}
 
开发者ID:BitLimit,项目名称:Bits,代码行数:8,代码来源:PersistenceThread.java

示例7: 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;
}
 
开发者ID:roblabla,项目名称:BungeeBan,代码行数:8,代码来源:MySQLBanStore.java

示例8: 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;
}
 
开发者ID:roblabla,项目名称:BungeeBan,代码行数:8,代码来源:MySQLBanStore.java

示例9: 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;
}
 
开发者ID:roblabla,项目名称:BungeeBan,代码行数:8,代码来源:MySQLBanStore.java

示例10: 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;
}
 
开发者ID:roblabla,项目名称:BungeeBan,代码行数:14,代码来源:MySQLBanStore.java

示例11: 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;
}
 
开发者ID:roblabla,项目名称:BungeeBan,代码行数:14,代码来源:MySQLBanStore.java

示例12: 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();
}
 
开发者ID:roblabla,项目名称:BungeeBan,代码行数:12,代码来源:MySQLBanStore.java

示例13: isIPBanned

import org.javalite.activejdbc.Base; //导入方法依赖的package包/类
@Override
public BanEntry isIPBanned(String ip, String server) {
	if (!Base.hasConnection()) {
		Base.open(bonecp);
	}
	List<SqlIPBanEntry> entries = SqlIPBanEntry.where("banned = ? AND server = ?", ip, server);
	if (entries.size() < 1) {
		return null;
	}
	return entries.get(0).toBanEntry();
}
 
开发者ID:roblabla,项目名称:BungeeBan,代码行数:12,代码来源:MySQLBanStore.java

示例14: main

import org.javalite.activejdbc.Base; //导入方法依赖的package包/类
public static void main( String[] args )
{
  Base.open("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/trivia", "franco", "franco");

  // User u = new User();
  // u.set("username", "Maradona");
  // u.set("password", "messi");
  // u.saveIt();

  // User u = new User();
  // u.set("username", "Pele");
  // u.set("password", "pele");
  // u.saveIt();

  // Question question = new Question();
  // question.set("description", "Quien es el mejor equipo?");
  // question.set("option_1", "River");
  // question.set("option_2", "Boca");
  // question.saveIt();

  // Game g = new Game();
  // List<User> users = User.where("username = ?", "Maradona");
  // User u = users.get(0);
  // g.set("user1_id", u.get("id"));
  // User u2 = User.findFirst("username = ?", "Pele");
  // g.set("user2_id", u2.get("id"));
  // g.saveIt();


  // g.getQuestion()
  // g.answerQuestio(USEr, Question, OPtion)

  Map map = new HashMap();
  map.put("name", "Sam");
  map.put("value", 1000);
  map.put("taxed_value", 1000 - (1000 * 0.4));
  map.put("in_ca", true);

  get("/hello", (req, res) -> {
    return new ModelAndView(map, "./views/test.mustache");
  }, new MustacheTemplateEngine()
  );

  Base.close();
}
 
开发者ID:se-unrc,项目名称:pregunta2,代码行数:46,代码来源:App.java

示例15: before

import org.javalite.activejdbc.Base; //导入方法依赖的package包/类
@Before
public void before(){
    Base.open("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/trivia_test", "franco", "franco");
    System.out.println("UserTest setup");
    Base.openTransaction();
}
 
开发者ID:se-unrc,项目名称:pregunta2,代码行数:7,代码来源:UserTest.java


注:本文中的org.javalite.activejdbc.Base.open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。