本文整理了Java中com.j256.ormlite.dao.Dao.isTableExists()
方法的一些代码示例,展示了Dao.isTableExists()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dao.isTableExists()
方法的具体详情如下:
包路径:com.j256.ormlite.dao.Dao
类名称:Dao
方法名:isTableExists
[英]Returns true if the table already exists otherwise false.
[中]如果表已存在,则返回true,否则返回false。
代码示例来源:origin: com.j256.ormlite/ormlite-core
/**
* @see Dao#isTableExists()
*/
@Override
public boolean isTableExists() {
try {
return dao.isTableExists();
} catch (SQLException e) {
logMessage(e, "isTableExists threw exception");
throw new RuntimeException(e);
}
}
代码示例来源:origin: j256/ormlite-core
/**
* @see Dao#isTableExists()
*/
@Override
public boolean isTableExists() {
try {
return dao.isTableExists();
} catch (SQLException e) {
logMessage(e, "isTableExists threw exception");
throw new RuntimeException(e);
}
}
代码示例来源:origin: annmuor/jnode
protected GenericDAO() throws Exception {
if (daoMap == null) {
daoMap = new HashMap<>();
}
if (!daoMap.containsKey(getType())) {
Dao<?, ?> dao = DaoManager.createDao(ORMManager.getSource(),
getType());
if (!dao.isTableExists()) {
TableUtils.createTable(ORMManager.getSource(), getType());
}
daoMap.put(getType(), dao);
}
}
代码示例来源:origin: j256/ormlite-core
@Test(expected = RuntimeException.class)
public void testIsTableExistsThrow() throws Exception {
@SuppressWarnings("unchecked")
Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class);
RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao);
expect(dao.isTableExists()).andThrow(new SQLException("Testing catch"));
replay(dao);
rtDao.isTableExists();
verify(dao);
}
代码示例来源:origin: j256/ormlite-core
@Test
public void testIsTableExists() throws Exception {
Dao<TableExists, Integer> dao = createDao(TableExists.class, false);
assertFalse(dao.isTableExists());
TableUtils.createTable(connectionSource, TableExists.class);
assertTrue(dao.isTableExists());
TableUtils.dropTable(connectionSource, TableExists.class, true);
assertFalse(dao.isTableExists());
}
代码示例来源:origin: com.j256.ormlite/ormlite-jdbc
@Test
public void testTableExists() throws Exception {
Dao<Foo, Integer> dao = createDao(Foo.class, false);
assertFalse(dao.isTableExists());
TableUtils.createTable(connectionSource, Foo.class);
assertTrue(dao.isTableExists());
TableUtils.dropTable(connectionSource, Foo.class, false);
assertFalse(dao.isTableExists());
}
代码示例来源:origin: j256/ormlite-core
@Test(expected = SQLException.class)
public void testIsTableExistsThrow() throws Exception {
Dao<Foo, Integer> dao = createDao(Foo.class, true);
Foo foo = new Foo();
assertEquals(1, dao.create(foo));
DatabaseConnection conn = connectionSource.getReadWriteConnection(FOO_TABLE_NAME);
try {
conn.close();
dao.isTableExists();
} finally {
connectionSource.releaseConnection(conn);
}
}
内容来源于网络,如有侵权,请联系作者删除!