org.greenrobot.greendao.database.Database Java Examples

The following examples show how to use org.greenrobot.greendao.database.Database. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DaoSession.java    From Android-IM with Apache License 2.0 6 votes vote down vote up
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
        daoConfigMap) {
    super(db);

    userDaoConfig = daoConfigMap.get(UserDao.class).clone();
    userDaoConfig.initIdentityScope(type);

    searchAddDaoConfig = daoConfigMap.get(SearchAddDao.class).clone();
    searchAddDaoConfig.initIdentityScope(type);

    requestListDaoConfig = daoConfigMap.get(RequestListDao.class).clone();
    requestListDaoConfig.initIdentityScope(type);

    chatLogDaoConfig = daoConfigMap.get(ChatLogDao.class).clone();
    chatLogDaoConfig.initIdentityScope(type);

    userDao = new UserDao(userDaoConfig, this);
    searchAddDao = new SearchAddDao(searchAddDaoConfig, this);
    requestListDao = new RequestListDao(requestListDaoConfig, this);
    chatLogDao = new ChatLogDao(chatLogDaoConfig, this);

    registerDao(User.class, userDao);
    registerDao(SearchAdd.class, searchAddDao);
    registerDao(RequestList.class, requestListDao);
    registerDao(ChatLog.class, chatLogDao);
}
 
Example #2
Source File: DbMigrationHelper.java    From ml-authentication with Apache License 2.0 6 votes vote down vote up
private static List<String> getColumns(Database db, String tableName) {
    Log.i(DbMigrationHelper.class.getName(), "getColumns");

    List<String> columns = null;
    Cursor cursor = null;
    try {
        cursor = db.rawQuery("SELECT * FROM " + tableName + " limit 0", null);
        if (null != cursor && cursor.getColumnCount() > 0) {
            columns = Arrays.asList(cursor.getColumnNames());
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        if (cursor != null)
            cursor.close();
        if (null == columns)
            columns = new ArrayList<>();
    }
    return columns;
}
 
Example #3
Source File: BookShelfBeanDao.java    From HaoReader with GNU General Public License v3.0 6 votes vote down vote up
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
    String constraint = ifNotExists? "IF NOT EXISTS ": "";
    db.execSQL("CREATE TABLE " + constraint + "\"BOOK_SHELF_BEAN\" (" + //
            "\"NOTE_URL\" TEXT PRIMARY KEY NOT NULL ," + // 0: noteUrl
            "\"DUR_CHAPTER\" INTEGER," + // 1: durChapter
            "\"DUR_CHAPTER_PAGE\" INTEGER," + // 2: durChapterPage
            "\"FINAL_DATE\" INTEGER," + // 3: finalDate
            "\"HAS_UPDATE\" INTEGER," + // 4: hasUpdate
            "\"NEW_CHAPTERS\" INTEGER," + // 5: newChapters
            "\"TAG\" TEXT," + // 6: tag
            "\"SERIAL_NUMBER\" INTEGER," + // 7: serialNumber
            "\"FINAL_REFRESH_DATA\" INTEGER," + // 8: finalRefreshData
            "\"GROUP\" INTEGER," + // 9: group
            "\"DUR_CHAPTER_NAME\" TEXT," + // 10: durChapterName
            "\"LAST_CHAPTER_NAME\" TEXT," + // 11: lastChapterName
            "\"CHAPTER_LIST_SIZE\" INTEGER," + // 12: chapterListSize
            "\"UPDATE_OFF\" INTEGER," + // 13: updateOff
            "\"VARIABLE_STRING\" TEXT);"); // 14: variableString
}
 
Example #4
Source File: SQLiteOpenHelper.java    From AssistantBySDK with Apache License 2.0 6 votes vote down vote up
@Override
public void onUpgrade(Database db, int oldVersion, int newVersion) {
    Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
    MigrationHelper.getInstance().migrate(db
            , AccountingDao.class
            , AlarmClockDao.class
            , BaiduAddressDao.class
            , CallLogProxyDao.class
            , ContactsProxyDao.class
            , ItemDao.class
            , MemoDao.class
            , MetaDataDao.class
            , NaviRecordDao.class
            , PlayMusicDao.class
            , RemindDao.class
            , SmsProxyDao.class
            , SubItemDao.class
            , TapeDao.class
            , TrackAlbumDao.class
            , UserDao.class
            , ZipcodeDao.class
            , FileDownLogDao.class);
}
 
Example #5
Source File: DbMigrationHelper.java    From ml-authentication with Apache License 2.0 6 votes vote down vote up
private static List<String> getColumns(Database db, String tableName) {
    Log.i(DbMigrationHelper.class.getName(), "getColumns");

    List<String> columns = null;
    Cursor cursor = null;
    try {
        cursor = db.rawQuery("SELECT * FROM " + tableName + " limit 0", null);
        if (null != cursor && cursor.getColumnCount() > 0) {
            columns = Arrays.asList(cursor.getColumnNames());
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        if (cursor != null)
            cursor.close();
        if (null == columns)
            columns = new ArrayList<>();
    }
    return columns;
}
 
Example #6
Source File: DaoMigrationHelper.java    From android-mvp-starter with MIT License 6 votes vote down vote up
public void migrate(SQLiteDatabase db, Class<? extends AbstractDao<?, ?>>... daoClasses) {
    Database database = new StandardDatabase(db);
    if (DEBUG) {
        Log.d(TAG, "【Database Version】" + db.getVersion());
        Log.d(TAG, "【Generate temp table】start");
    }
    generateTempTables(database, daoClasses);
    if (DEBUG) {
        Log.d(TAG, "【Generate temp table】complete");
    }
    dropAllTables(database, true, daoClasses);
    createAllTables(database, false, daoClasses);
    if (DEBUG) {
        Log.d(TAG, "【Restore data】start");
    }
    restoreData(database, daoClasses);
    if (DEBUG) {
        Log.d(TAG, "【Restore data】complete");
    }
}
 
Example #7
Source File: DBOpenHelper.java    From OpenHub with GNU General Public License v3.0 6 votes vote down vote up
private void transferBookmarksAndTraceData(Database db){
    DaoSession daoSession = new DaoMaster(db).newSession();
    List<TraceRepo> traceRepoList = daoSession.getTraceRepoDao().loadAll();
    List<TraceUser> traceUserList = daoSession.getTraceUserDao().loadAll();
    List<BookMarkRepo> bookmarkRepoList = daoSession.getBookMarkRepoDao().loadAll();
    List<BookMarkUser> bookMarkUserList = daoSession.getBookMarkUserDao().loadAll();

    List<LocalRepo> localRepoList = getLocalRepoList(traceRepoList, bookmarkRepoList);
    List<LocalUser> localUserList = getLocalUserList(traceUserList, bookMarkUserList);
    List<Trace> traceList = getTraceList(traceRepoList, traceUserList);
    List<Bookmark> bookmarkList = getBookmarkList(bookmarkRepoList, bookMarkUserList);

    daoSession.getLocalRepoDao().insertInTx(localRepoList);
    daoSession.getLocalUserDao().insertInTx(localUserList);
    daoSession.getTraceDao().insertInTx(traceList);
    daoSession.getBookmarkDao().insertInTx(bookmarkList);

    daoSession.clear();
}
 
Example #8
Source File: BookMarkUserDao.java    From OpenHub with GNU General Public License v3.0 5 votes vote down vote up
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
    String constraint = ifNotExists? "IF NOT EXISTS ": "";
    db.execSQL("CREATE TABLE " + constraint + "\"BOOK_MARK_USER\" (" + //
            "\"LOGIN\" TEXT PRIMARY KEY NOT NULL ," + // 0: login
            "\"NAME\" TEXT," + // 1: name
            "\"AVATAR_URL\" TEXT," + // 2: avatarUrl
            "\"FOLLOWERS\" INTEGER," + // 3: followers
            "\"FOLLOWING\" INTEGER," + // 4: following
            "\"MARK_TIME\" INTEGER);"); // 5: markTime
}
 
Example #9
Source File: MagicPhotoEntityDao.java    From PLDroidShortVideo with Apache License 2.0 5 votes vote down vote up
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
    String constraint = ifNotExists? "IF NOT EXISTS ": "";
    db.execSQL("CREATE TABLE " + constraint + "\"MAGIC_PHOTO_ENTITY\" (" + //
            "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
            "\"WIDTH\" INTEGER NOT NULL ," + // 1: width
            "\"HEIGHT\" INTEGER NOT NULL ," + // 2: height
            "\"GROUP_POINTS_STR\" TEXT," + // 3: groupPointsStr
            "\"GROUP_TYPE_STR\" TEXT," + // 4: groupTypeStr
            "\"IMAGE_PATH\" TEXT);"); // 5: imagePath
}
 
Example #10
Source File: UserDBManager.java    From NewFastFrame with Apache License 2.0 5 votes vote down vote up
private UserDBManager(String uid) {
    DaoMaster.DevOpenHelper devOpenHelper = new DaoMaster.DevOpenHelper(BaseApplication.getInstance(), uid, null);
    Database database = devOpenHelper.getWritableDb();
    DaoMaster master = new DaoMaster(database);
    daoSession = master.newSession();
    gson = BaseApplication.getAppComponent().getGson();
}
 
Example #11
Source File: DatabaseHelper.java    From GeometricWeather with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onUpgrade(Database db, int oldVersion, int newVersion) {
    switch (oldVersion) {
        case 52:
        case 51:
        case 50:
        case 49:
        case 48:
        case 47:
            WeatherEntityDao.dropTable(db, true);
            DailyEntityDao.dropTable(db, true);
            HourlyEntityDao.dropTable(db, true);
            MinutelyEntityDao.dropTable(db, true);
            AlertEntityDao.dropTable(db, true);
            HistoryEntityDao.dropTable(db, true);

            WeatherEntityDao.createTable(db, true);
            DailyEntityDao.createTable(db, true);
            HourlyEntityDao.createTable(db, true);
            MinutelyEntityDao.createTable(db, true);
            AlertEntityDao.createTable(db, true);
            HistoryEntityDao.createTable(db, true);
            break;

        default:
            super.onUpgrade(db, oldVersion, newVersion);
            break;
    }
}
 
Example #12
Source File: MigrationHelper.java    From NovelReader with MIT License 5 votes vote down vote up
/**
 * 存储新的数据库表 以及数据
 *
 * @param db
 * @param daoClasses
 */
private void restoreData(Database db, Class<? extends AbstractDao<?, ?>>... daoClasses) {
    for (int i = 0; i < daoClasses.length; i++) {
        DaoConfig daoConfig = new DaoConfig(db, daoClasses[i]);
        String tableName = daoConfig.tablename;
        String tempTableName = daoConfig.tablename.concat("_TEMP");
        ArrayList<String> properties = new ArrayList();

        for (int j = 0; j < daoConfig.properties.length; j++) {
            String columnName = daoConfig.properties[j].columnName;

            if (getColumns(db, tempTableName).contains(columnName)) {
                properties.add(columnName);
            }
        }

        StringBuilder insertTableStringBuilder = new StringBuilder();

        insertTableStringBuilder.append("INSERT INTO ").append(tableName).append(" (");
        insertTableStringBuilder.append(TextUtils.join(",", properties));
        insertTableStringBuilder.append(") SELECT ");
        insertTableStringBuilder.append(TextUtils.join(",", properties));
        insertTableStringBuilder.append(" FROM ").append(tempTableName).append(";");

        StringBuilder dropTableStringBuilder = new StringBuilder();
        dropTableStringBuilder.append("DROP TABLE ").append(tempTableName);
        db.execSQL(insertTableStringBuilder.toString());
        db.execSQL(dropTableStringBuilder.toString());
    }
}
 
Example #13
Source File: DbOpenHelper.java    From android-mvp-architecture with Apache License 2.0 5 votes vote down vote up
@Override
public void onUpgrade(Database db, int oldVersion, int newVersion) {
    super.onUpgrade(db, oldVersion, newVersion);
    AppLogger.d("DEBUG", "DB_OLD_VERSION : " + oldVersion + ", DB_NEW_VERSION : " + newVersion);
    switch (oldVersion) {
        case 1:
        case 2:
            //db.execSQL("ALTER TABLE " + UserDao.TABLENAME + " ADD COLUMN "
            // + UserDao.Properties.Name.columnName + " TEXT DEFAULT 'DEFAULT_VAL'");
    }
}
 
Example #14
Source File: DaoMaster.java    From CoolChat with Apache License 2.0 5 votes vote down vote up
/** Drops underlying database table using DAOs. */
public static void dropAllTables(Database db, boolean ifExists) {
    ChatDao.dropTable(db, ifExists);
    ContactDao.dropTable(db, ifExists);
    ConversationDao.dropTable(db, ifExists);
    GroupDao.dropTable(db, ifExists);
    GroupUsersDao.dropTable(db, ifExists);
}
 
Example #15
Source File: Update2Helper.java    From NovelReader with MIT License 5 votes vote down vote up
private void updateBookChapter(Database db) {
    Class<? extends AbstractDao<?, ?>> bookChapterClass = BookChapterBeanDao.class;

    generateTempTables(db, bookChapterClass);
    deleteOriginalTables(db, bookChapterClass);
    createOrignalTables(db, bookChapterClass);
    restoreData(db, bookChapterClass);
}
 
Example #16
Source File: DaoMaster.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
public DaoMaster(Database db) {
    super(db, SCHEMA_VERSION);
    registerDaoClass(AuthenticationEventDao.class);
    registerDaoClass(StudentImageCollectionEventDao.class);
    registerDaoClass(AllophoneDao.class);
    registerDaoClass(LetterDao.class);
    registerDaoClass(AudioDao.class);
    registerDaoClass(ImageDao.class);
    registerDaoClass(JoinAudiosWithLettersDao.class);
    registerDaoClass(JoinAudiosWithNumbersDao.class);
    registerDaoClass(JoinAudiosWithWordsDao.class);
    registerDaoClass(JoinImagesWithLettersDao.class);
    registerDaoClass(JoinImagesWithNumbersDao.class);
    registerDaoClass(JoinImagesWithWordsDao.class);
    registerDaoClass(JoinVideosWithLettersDao.class);
    registerDaoClass(JoinVideosWithNumbersDao.class);
    registerDaoClass(JoinVideosWithWordsDao.class);
    registerDaoClass(VideoDao.class);
    registerDaoClass(NumberDao.class);
    registerDaoClass(StoryBookDao.class);
    registerDaoClass(SyllableDao.class);
    registerDaoClass(WordDao.class);
    registerDaoClass(DeviceDao.class);
    registerDaoClass(JoinLettersWithAllophonesDao.class);
    registerDaoClass(JoinNumbersWithWordsDao.class);
    registerDaoClass(JoinStudentsWithDevicesDao.class);
    registerDaoClass(StudentDao.class);
    registerDaoClass(StudentImageDao.class);
    registerDaoClass(StudentImageFeatureDao.class);
}
 
Example #17
Source File: FtsDao.java    From android-app with GNU General Public License v3.0 5 votes vote down vote up
private static void createViewForFts(Database db, boolean ifNotExists) {
    final String id = ArticleDao.Properties.Id.columnName;

    String viewQuery = "select a." + id + " rowid" +
            ", a." + ArticleDao.Properties.Title.columnName +
            ", c." + ArticleContentDao.Properties.Content.columnName +
            " from " + ArticleDao.TABLENAME + " a join " + ArticleContentDao.TABLENAME + " c" +
            " using (" + id + ")";

    String createViewQuery = "create view " + getIfNotExistsConstraint(ifNotExists) +
            VIEW_FOR_FTS_NAME + " as " + viewQuery;

    db.execSQL(createViewQuery);
}
 
Example #18
Source File: CookieBeanDao.java    From HaoReader with GNU General Public License v3.0 5 votes vote down vote up
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
    String constraint = ifNotExists? "IF NOT EXISTS ": "";
    db.execSQL("CREATE TABLE " + constraint + "\"COOKIE_BEAN\" (" + //
            "\"URL\" TEXT PRIMARY KEY NOT NULL ," + // 0: url
            "\"COOKIE\" TEXT);"); // 1: cookie
}
 
Example #19
Source File: App.java    From KUtils with Apache License 2.0 5 votes vote down vote up
private void initGreenDao() {
    DaoMaster.DevOpenHelper openHelper = new DaoMaster.DevOpenHelper(getApplicationContext(), DBNAME);
    Database db = openHelper.getWritableDb();
    DaoMaster daoMaster = new DaoMaster(db);
    mDaoSession = daoMaster.newSession();
    Log.d("GreenDao初始化成功");
}
 
Example #20
Source File: DaoSessionResource.java    From friendly-plans with GNU General Public License v3.0 5 votes vote down vote up
public DaoSession getSession(Context context) {
    DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(
            context,
            FRIENDLY_PLANS_DB_NAME);
    Database db = helper.getWritableDb();
    return new DaoMaster(db).newSession();
}
 
Example #21
Source File: DaoMaster.java    From OpenHub with GNU General Public License v3.0 5 votes vote down vote up
/** Creates underlying database table using DAOs. */
public static void createAllTables(Database db, boolean ifNotExists) {
    AuthUserDao.createTable(db, ifNotExists);
    TraceUserDao.createTable(db, ifNotExists);
    TraceRepoDao.createTable(db, ifNotExists);
    BookMarkUserDao.createTable(db, ifNotExists);
    BookMarkRepoDao.createTable(db, ifNotExists);
    LocalUserDao.createTable(db, ifNotExists);
    LocalRepoDao.createTable(db, ifNotExists);
    TraceDao.createTable(db, ifNotExists);
    BookmarkDao.createTable(db, ifNotExists);
    MyTrendingLanguageDao.createTable(db, ifNotExists);
}
 
Example #22
Source File: JoinAudiosWithNumbersDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
    String constraint = ifNotExists? "IF NOT EXISTS ": "";
    db.execSQL("CREATE TABLE " + constraint + "\"JOIN_AUDIOS_WITH_NUMBERS\" (" + //
            "\"_id\" INTEGER PRIMARY KEY ," + // 0: id
            "\"AUDIO_ID\" INTEGER NOT NULL ," + // 1: audioId
            "\"NUMBER_ID\" INTEGER NOT NULL );"); // 2: numberId
}
 
Example #23
Source File: SyllableDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
    String constraint = ifNotExists? "IF NOT EXISTS ": "";
    db.execSQL("CREATE TABLE " + constraint + "\"SYLLABLE\" (" + //
            "\"_id\" INTEGER PRIMARY KEY ," + // 0: id
            "\"LOCALE\" TEXT NOT NULL ," + // 1: locale
            "\"TIME_LAST_UPDATE\" INTEGER," + // 2: timeLastUpdate
            "\"REVISION_NUMBER\" INTEGER NOT NULL ," + // 3: revisionNumber
            "\"CONTENT_STATUS\" TEXT NOT NULL ," + // 4: contentStatus
            "\"TEXT\" TEXT NOT NULL ," + // 5: text
            "\"USAGE_COUNT\" INTEGER NOT NULL );"); // 6: usageCount
}
 
Example #24
Source File: AddressDao.java    From enjoyshop with Apache License 2.0 5 votes vote down vote up
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
    String constraint = ifNotExists? "IF NOT EXISTS ": "";
    db.execSQL("CREATE TABLE " + constraint + "\"ADDRESS\" (" + //
            "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: addressId
            "\"USER_ID\" INTEGER," + // 1: userId
            "\"NAME\" TEXT," + // 2: name
            "\"PHONE\" TEXT," + // 3: phone
            "\"IS_DEFAULT_ADDRESS\" INTEGER NOT NULL ," + // 4: isDefaultAddress
            "\"BIG_ADDRESS\" TEXT," + // 5: bigAddress
            "\"SMALL_ADDRESS\" TEXT," + // 6: smallAddress
            "\"ADDRESS\" TEXT);"); // 7: address
}
 
Example #25
Source File: DbMigrationHelper.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
private static void restoreData(Database db, Class<? extends AbstractDao<?, ?>>... daoClasses) {
    Log.i(DbMigrationHelper.class.getName(), "restoreData");

    for (int i = 0; i < daoClasses.length; i++) {
        DaoConfig daoConfig = new DaoConfig(db, daoClasses[i]);
        String tableName = daoConfig.tablename;
        String tempTableName = daoConfig.tablename.concat("_TEMP");
        // get all columns from tempTable, take careful to use the columns list
        List<String> columns = getColumns(db, tempTableName);
        ArrayList<String> properties = new ArrayList<>(columns.size());
        for (int j = 0; j < daoConfig.properties.length; j++) {
            String columnName = daoConfig.properties[j].columnName;
            if (columns.contains(columnName)) {
                properties.add(columnName);
            }
        }
        if (properties.size() > 0) {
            final String columnSQL = TextUtils.join(",", properties);

            StringBuilder insertTableStringBuilder = new StringBuilder();
            insertTableStringBuilder.append("INSERT INTO ").append(tableName).append(" (");
            insertTableStringBuilder.append(columnSQL);
            insertTableStringBuilder.append(") SELECT ");
            insertTableStringBuilder.append(columnSQL);
            insertTableStringBuilder.append(" FROM ").append(tempTableName).append(";");
            Log.i(DbMigrationHelper.class.getName(), "insertTableStringBuilder: " + insertTableStringBuilder);
            db.execSQL(insertTableStringBuilder.toString());
        }
        StringBuilder dropTableStringBuilder = new StringBuilder();
        dropTableStringBuilder.append("DROP TABLE ").append(tempTableName);
        db.execSQL(dropTableStringBuilder.toString());
    }
}
 
Example #26
Source File: JoinNumbersWithWordsDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
    String constraint = ifNotExists? "IF NOT EXISTS ": "";
    db.execSQL("CREATE TABLE " + constraint + "\"JOIN_NUMBERS_WITH_WORDS\" (" + //
            "\"_id\" INTEGER PRIMARY KEY ," + // 0: id
            "\"NUMBER_ID\" INTEGER NOT NULL ," + // 1: numberId
            "\"WORD_ID\" INTEGER NOT NULL );"); // 2: wordId
}
 
Example #27
Source File: DaoMaster.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Drops underlying database table using DAOs. */
public static void dropAllTables(Database db, boolean ifExists) {
    AuthenticationEventDao.dropTable(db, ifExists);
    StudentImageCollectionEventDao.dropTable(db, ifExists);
    AllophoneDao.dropTable(db, ifExists);
    LetterDao.dropTable(db, ifExists);
    AudioDao.dropTable(db, ifExists);
    ImageDao.dropTable(db, ifExists);
    JoinAudiosWithLettersDao.dropTable(db, ifExists);
    JoinAudiosWithNumbersDao.dropTable(db, ifExists);
    JoinAudiosWithWordsDao.dropTable(db, ifExists);
    JoinImagesWithLettersDao.dropTable(db, ifExists);
    JoinImagesWithNumbersDao.dropTable(db, ifExists);
    JoinImagesWithWordsDao.dropTable(db, ifExists);
    JoinVideosWithLettersDao.dropTable(db, ifExists);
    JoinVideosWithNumbersDao.dropTable(db, ifExists);
    JoinVideosWithWordsDao.dropTable(db, ifExists);
    VideoDao.dropTable(db, ifExists);
    NumberDao.dropTable(db, ifExists);
    StoryBookDao.dropTable(db, ifExists);
    SyllableDao.dropTable(db, ifExists);
    WordDao.dropTable(db, ifExists);
    DeviceDao.dropTable(db, ifExists);
    JoinLettersWithAllophonesDao.dropTable(db, ifExists);
    JoinNumbersWithWordsDao.dropTable(db, ifExists);
    JoinStudentsWithDevicesDao.dropTable(db, ifExists);
    StudentDao.dropTable(db, ifExists);
    StudentImageDao.dropTable(db, ifExists);
    StudentImageFeatureDao.dropTable(db, ifExists);
}
 
Example #28
Source File: NumberDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
    String constraint = ifNotExists? "IF NOT EXISTS ": "";
    db.execSQL("CREATE TABLE " + constraint + "\"NUMBER\" (" + //
            "\"_id\" INTEGER PRIMARY KEY ," + // 0: id
            "\"LOCALE\" TEXT NOT NULL ," + // 1: locale
            "\"TIME_LAST_UPDATE\" INTEGER," + // 2: timeLastUpdate
            "\"REVISION_NUMBER\" INTEGER NOT NULL ," + // 3: revisionNumber
            "\"CONTENT_STATUS\" TEXT NOT NULL ," + // 4: contentStatus
            "\"VALUE\" INTEGER NOT NULL ," + // 5: value
            "\"SYMBOL\" TEXT);"); // 6: symbol
}
 
Example #29
Source File: JoinLettersWithAllophonesDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
    String constraint = ifNotExists? "IF NOT EXISTS ": "";
    db.execSQL("CREATE TABLE " + constraint + "\"JOIN_LETTERS_WITH_ALLOPHONES\" (" + //
            "\"_id\" INTEGER PRIMARY KEY ," + // 0: id
            "\"LETTER_ID\" INTEGER NOT NULL ," + // 1: letterId
            "\"ALLOPHONE_ID\" INTEGER NOT NULL );"); // 2: allophoneId
}
 
Example #30
Source File: StudentImageFeatureDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
    String constraint = ifNotExists? "IF NOT EXISTS ": "";
    db.execSQL("CREATE TABLE " + constraint + "\"STUDENT_IMAGE_FEATURE\" (" + //
            "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
            "\"TIME_CREATED\" INTEGER NOT NULL ," + // 1: timeCreated
            "\"FEATURE_VECTOR\" TEXT NOT NULL );"); // 2: featureVector
}