com.j256.ormlite.dao.Dao.getTableName()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中com.j256.ormlite.dao.Dao.getTableName()方法的一些代码示例,展示了Dao.getTableName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dao.getTableName()方法的具体详情如下:
包路径:com.j256.ormlite.dao.Dao
类名称:Dao
方法名:getTableName

Dao.getTableName介绍

[英]Return the name of the table that this DAO is handling.
[中]返回此DAO正在处理的表的名称。

代码示例

代码示例来源:origin: j256/ormlite-core

@Override
public String getTableName() {
  return dao.getTableName();
}

代码示例来源:origin: com.j256.ormlite/ormlite-core

@Override
public String getTableName() {
  return dao.getTableName();
}

代码示例来源:origin: com.j256.ormlite/ormlite-android

@Override
public Cursor loadInBackground() {
  Cursor cursor;
  try {
    DatabaseConnection connection = dao.getConnectionSource().getReadOnlyConnection(dao.getTableName());
    AndroidCompiledStatement statement = (AndroidCompiledStatement) query.compile(connection, SELECT);
    cursor = statement.getCursor();
  } catch (SQLException e) {
    throw new RuntimeException(e);
  }
  // fill the cursor with results
  cursor.getCount();
  return cursor;
}

代码示例来源:origin: com.j256.ormlite/ormlite-android

@Override
public Cursor loadInBackground() {
  Cursor cursor;
  try {
    DatabaseConnection connection = dao.getConnectionSource().getReadOnlyConnection(dao.getTableName());
    AndroidCompiledStatement statement = (AndroidCompiledStatement) query.compile(connection, SELECT);
    cursor = statement.getCursor();
  } catch (SQLException e) {
    throw new RuntimeException(e);
  }
  // fill the cursor with results
  cursor.getCount();
  return cursor;
}

代码示例来源:origin: j256/ormlite-core

@Test
public void testGetTableName() throws Exception {
  Dao<Foo, Integer> dao = createDao(Foo.class, true);
  assertEquals(FOO_TABLE_NAME, dao.getTableName());
}

代码示例来源:origin: j256/ormlite-core

@Test
public void testCallBatchTasksNestedInTransaction() throws Exception {
  SpecialConnectionSource cs = new SpecialConnectionSource(new H2ConnectionSource());
  final Dao<Foo, Integer> dao = DaoManager.createDao(cs, Foo.class);
  TableUtils.createTable(cs, Foo.class);
  final Foo foo = new Foo();
  assertEquals(1, dao.create(foo));
  TransactionManager.callInTransaction(cs, new Callable<Void>() {
    @Override
    public Void call() throws Exception {
      dao.callBatchTasks(new Callable<Void>() {
        @Override
        public Void call() throws Exception {
          dao.delete(foo);
          return null;
        }
      });
      return null;
    }
  });
  // make sure the delete happened
  assertNull(dao.queryForId(foo.id));
  // make sure there is no special connection
  assertNull(cs.getSpecialConnection(dao.getTableName()));
}

相关文章