Search in sources :

Example 21 with Database

use of org.greenrobot.greendao.database.Database in project greenDAO by greenrobot.

the class App method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    DevOpenHelper helper = new DevOpenHelper(this, ENCRYPTED ? "notes-db-encrypted" : "notes-db");
    Database db = ENCRYPTED ? helper.getEncryptedWritableDb("super-secret") : helper.getWritableDb();
    daoSession = new DaoMaster(db).newSession();
}
Also used : DevOpenHelper(org.greenrobot.greendao.example.DaoMaster.DevOpenHelper) Database(org.greenrobot.greendao.database.Database)

Example 22 with Database

use of org.greenrobot.greendao.database.Database in project AndroidDevelop by 7449.

the class DaoMaster method newDevSession.

/**
     * WARNING: Drops all table on Upgrade! Use only during development.
     * Convenience method using a {@link DevOpenHelper}.
     */
public static DaoSession newDevSession(Context context, String name) {
    Database db = new DevOpenHelper(context, name).getWritableDb();
    DaoMaster daoMaster = new DaoMaster(db);
    return daoMaster.newSession();
}
Also used : AbstractDaoMaster(org.greenrobot.greendao.AbstractDaoMaster) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) Database(org.greenrobot.greendao.database.Database) StandardDatabase(org.greenrobot.greendao.database.StandardDatabase)

Example 23 with Database

use of org.greenrobot.greendao.database.Database in project AndroidDevelop by 7449.

the class DaoMaster method newDevSession.

/**
     * WARNING: Drops all table on Upgrade! Use only during development.
     * Convenience method using a {@link DevOpenHelper}.
     */
public static DaoSession newDevSession(Context context, String name) {
    Database db = new DevOpenHelper(context, name).getWritableDb();
    DaoMaster daoMaster = new DaoMaster(db);
    return daoMaster.newSession();
}
Also used : AbstractDaoMaster(org.greenrobot.greendao.AbstractDaoMaster) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) Database(org.greenrobot.greendao.database.Database) StandardDatabase(org.greenrobot.greendao.database.StandardDatabase)

Example 24 with Database

use of org.greenrobot.greendao.database.Database in project DevRing by LJYcoder.

the class DaoMaster method newDevSession.

/**
 * WARNING: Drops all table on Upgrade! Use only during development.
 * Convenience method using a {@link DevOpenHelper}.
 */
public static DaoSession newDevSession(Context context, String name) {
    Database db = new DevOpenHelper(context, name).getWritableDb();
    DaoMaster daoMaster = new DaoMaster(db);
    return daoMaster.newSession();
}
Also used : AbstractDaoMaster(org.greenrobot.greendao.AbstractDaoMaster) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) Database(org.greenrobot.greendao.database.Database) StandardDatabase(org.greenrobot.greendao.database.StandardDatabase)

Aggregations

Database (org.greenrobot.greendao.database.Database)24 StandardDatabase (org.greenrobot.greendao.database.StandardDatabase)13 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)12 AbstractDaoMaster (org.greenrobot.greendao.AbstractDaoMaster)11 DevOpenHelper (org.greenrobot.greendao.daotest.DaoMaster.DevOpenHelper)2 Cursor (android.database.Cursor)1 SQLiteQueryBuilder (android.database.sqlite.SQLiteQueryBuilder)1 ArrayList (java.util.ArrayList)1 DaoException (org.greenrobot.greendao.DaoException)1 OpenHelper (org.greenrobot.greendao.daotest.DaoMaster.OpenHelper)1 DatabaseStatement (org.greenrobot.greendao.database.DatabaseStatement)1 DevOpenHelper (org.greenrobot.greendao.example.DaoMaster.DevOpenHelper)1 Before (org.junit.Before)1