本文整理汇总了Java中com.j256.ormlite.android.AndroidConnectionSource类的典型用法代码示例。如果您正苦于以下问题:Java AndroidConnectionSource类的具体用法?Java AndroidConnectionSource怎么用?Java AndroidConnectionSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AndroidConnectionSource类属于com.j256.ormlite.android包,在下文中一共展示了AndroidConnectionSource类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import com.j256.ormlite.android.AndroidConnectionSource; //导入依赖的package包/类
@Before
public void setUp() throws SQLException {
LmisSqliteOpenHelper.getInstance(application).close();
mockUserService = mock(UserService.class);
when(mockUserService.getRegisteredUser()).thenReturn(new User("", "", "AU"));
setUpInjection(this, new AbstractModule() {
@Override
protected void configure() {
bind(UserService.class).toInstance(mockUserService);
}
});
openHelper = LmisSqliteOpenHelper.getInstance(application);// getHelper(application, LmisSqliteOpenHelper.class);
connectionSource = new AndroidConnectionSource(openHelper);
reasonDao = createDao(connectionSource, OrderReason.class);
orderDao = createDao(connectionSource, Order.class);
orderItemDao = createDao(connectionSource, OrderItem.class);
commodityDao = createDao(connectionSource, Commodity.class);
commodityActivityDao = createDao(connectionSource, CommodityAction.class);
categoryDao = createDao(connectionSource, Category.class);
orderTypeDao = createDao(connectionSource, OrderType.class);
dataSetDao = createDao(connectionSource, DataSet.class);
snapshotGenericDao = new GenericDao<>(CommoditySnapshot.class, Robolectric.application);
}
示例2: getRecordDao
import com.j256.ormlite.android.AndroidConnectionSource; //导入依赖的package包/类
public Dao<CrashInfo, Integer> getRecordDao() {
ConnectionSource connectionSource = new AndroidConnectionSource(this);
Dao<CrashInfo, Integer> dao = null;
try {
dao = getDao(CrashInfo.class);
} catch (SQLException e) {
e.printStackTrace();
}
// try {
// dao = BaseDaoImpl.createDao(connectionSource, CrashInfo.class);
// } catch (SQLException e) {
// e.printStackTrace();
// }
return dao;
}
示例3: OrmliteDao
import com.j256.ormlite.android.AndroidConnectionSource; //导入依赖的package包/类
public OrmliteDao(Context context) throws SQLException
{
DbOpenHelper helper = new DbOpenHelper(context);
conn = new AndroidConnectionSource(helper);
init();
csDao = DaoManager.createDao(conn, CharSheet.class);
aDao = DaoManager.createDao(conn, Attributes.class);
}
示例4: setUp
import com.j256.ormlite.android.AndroidConnectionSource; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
setUpInjectionWithMockLmisServer(application, this);
openHelper = LmisSqliteOpenHelper.getInstance(application);// getHelper(application, LmisSqliteOpenHelper.class);
connectionSource = new AndroidConnectionSource(openHelper);
commodityDao = createDao(connectionSource, Commodity.class);
stockDao = createDao(connectionSource, StockItem.class);
}
示例5: open
import com.j256.ormlite.android.AndroidConnectionSource; //导入依赖的package包/类
public void open() throws SQLException {// you get the SQLiteOpenHelper from your Android Activity
ConnectionSource connectionSource = new AndroidConnectionSource(dbHelper);
if (dbHelper == null) {
dbHelper = OpenHelperManager.getHelper(ctx, BookLibOpenDatabaseHelper.class);
}
}
示例6: get
import com.j256.ormlite.android.AndroidConnectionSource; //导入依赖的package包/类
@Override
public ConnectionSource get() {
final SQLiteDatabase sqliteDb = SQLiteDatabase.openDatabase(this.dictionaryDbPath, null, OPEN_READONLY | NO_LOCALIZED_COLLATORS);
final ConnectionSource connectionSource = new AndroidConnectionSource(sqliteDb);
return connectionSource;
}
示例7: GeoPackageConnection
import com.j256.ormlite.android.AndroidConnectionSource; //导入依赖的package包/类
/**
* Constructor
*
* @param db
*/
public GeoPackageConnection(GeoPackageDatabase db) {
this.db = db;
this.connectionSource = new AndroidConnectionSource(db.getDb());
}