Example #1
0
        /// <summary>
        ///  Prepare database tables if not already exists
        /// </summary>
        private void prepare(IFileData dummyInst, AtomicBoolean isNewTableCreated)
        {
            if (!checkTables())
            {
                // create new tables
                db.execSQL(SqlStr.genCreateTable(DBNAMES.FsBlock.ToString(), COLFSBLOCK));
                db.execSQL(SqlStr.genCreateTable(DBNAMES.FsInfo.ToString(), COLFSINFO));
                db.execSQL(SqlStr.genCreateTable(IFileData.DTABLENAME, dummyInst.ColSchema));

                // create root dir, too
                createRootDir();

                // Write default info
                writeInfo(FSINFOFIELDS.version.ToString(), SqlFsVersion.SqlFsVersion);
                writeInfo(FSINFOFIELDS.createTimeUtc.ToString(), TimeConverter.calendarToReadableDateTime(DateTime.getInstance(TimeZone.getTimeZone("GMT+00:00"))));
                writeInfo(FSINFOFIELDS.fsLabel.ToString(), SqlFsConst.DEFFSLABEL);
                writeInfo(FSINFOFIELDS.IDSize.ToString(), Convert.ToString(FsID.IDSize));

                isNewTableCreated.set(true);
            }
        }