SQLite
 sql >> Cơ Sở Dữ Liệu >  >> RDS >> SQLite

Bảng xóa nâng cấp Android Sqlite khỏi cơ sở dữ liệu

Sau đây là mã được sử dụng cho câu trả lời cho câu hỏi trước đó (liên kết bên dưới) được sửa đổi để bao gồm một phương pháp mới, cụ thể là restoreTable trong DatabaseAssetHandler.java

Phương thức này sẽ sao chép bất kỳ bảng nào, như được truyền, từ cơ sở dữ liệu đã sao lưu (được thực hiện khi sao chép cơ sở dữ liệu mới tạo thành thư mục nội dung (theo câu trả lời trước đó)). Nó không bao gồm các phức tạp của việc kiểm tra xem bảng đã qua có tồn tại hay không.

Nó mở hai phiên bản SQLiteDatabase cơ sở dữ liệu mới và cơ sở dữ liệu đã sao lưu cũ. Trích xuất tất cả các hàng từ cơ sở dữ liệu cũ và chèn chúng vào bảng có cùng tên trong cơ sở dữ liệu mới.

Phương pháp này, về bản chất của nó là:-

/**
 *
 * @param context   The context so that the respective package is used
 * @param dbname    The name of the database (the old will have -backup appended)
 * @param table     The table from which to copy the data
 */
public static void restoreTable(Context context, String dbname, String table) {
    ContentValues cv = new ContentValues();
    SQLiteDatabase dbnew = SQLiteDatabase.openDatabase(context.getDatabasePath(dbname).toString(), null,SQLiteDatabase.OPEN_READWRITE);
    SQLiteDatabase dbold = SQLiteDatabase.openDatabase(context.getDatabasePath(dbname + backup).toString(),null,SQLiteDatabase.OPEN_READONLY);
    Cursor csr = dbold.query(table,null,null,null,null,null,null);
    dbnew.beginTransaction();
    while (csr.moveToNext()) {
        cv.clear();
        int offset = 0;
        for (String column: csr.getColumnNames()) {
            switch (csr.getType(offset++)){
                case Cursor.FIELD_TYPE_NULL:
                    break;
                case Cursor.FIELD_TYPE_INTEGER:
                    cv.put(column,csr.getLong(csr.getColumnIndex(column)));
                    break;
                case Cursor.FIELD_TYPE_FLOAT:
                    cv.put(column,csr.getFloat(csr.getColumnIndex(column)));
                    break;
                case Cursor.FIELD_TYPE_STRING:
                    cv.put(column,csr.getString(csr.getColumnIndex(column)));
                    break;
                case Cursor.FIELD_TYPE_BLOB:
                    cv.put(column,csr.getBlob(csr.getColumnIndex(column)));
            }
        }
        dbnew.insert(DatabaseHelper.TABLE_BOOKMARK,null,cv);
    }
    dbnew.setTransactionSuccessful();
    dbnew.endTransaction();
    csr.close();
    dbnew.close();
    dbold.close();
}
  • Phương thức này cần được thêm vào mã DatabaseAssetHandler từ câu trả lời trước.

Để tạo điều kiện thuận lợi cho việc kiểm tra các điều trên, một số thay đổi đã được thực hiện đối với DatabaseHelper.java , bây giờ là:-

public class DatabaseHelper extends SQLiteOpenHelper {

    private  static final String DB_NAME = "dictionary.db";
    private static final int DB_VERSION = 2;
    public static final String TABLE_DICTIONARY = "dictionary";
    public static final String TABLE_BOOKMARK= "bookmark";
    public static final String COL_ID = "id";
    public static final String COL_WORD = "word";
    public static final String COL_DEFINITION = "definition";
    public static final String COL_WORID = "wordid"; //<<<<<<<<<< ADDED
    public Context mcontext;
    public SQLiteDatabase mDatabase;

    public DatabaseHelper(Context context) {
        super(context, DB_NAME, null, DB_VERSION);
        this.mcontext = context;
        Log.d("DBVERSION","The Database Version (as hard coded) is " + String.valueOf(DB_VERSION));

        int dbversion = DatabaseAssetHandler.getVersionFromDBFile(context,DB_NAME);
        Log.d("DBVERSION","The Database Version (as per the database file) is " + String.valueOf(dbversion));

        // Copy the Database if no database exists
        if (!DatabaseAssetHandler.checkDataBase(context,DB_NAME)) {
            DatabaseAssetHandler.copyDataBase(context,DB_NAME,true,DB_VERSION);
        } else {
            if (DB_VERSION > dbversion && DatabaseAssetHandler.checkDataBase(context, DB_NAME)) {
                DatabaseAssetHandler.copyDataBase(context, DB_NAME, true, DB_VERSION);
                DatabaseAssetHandler.restoreTable(context,DB_NAME,TABLE_BOOKMARK); //<<<<<<<<<< ADDED for keeping the BOOKMARKS
                DatabaseAssetHandler.clearForceBackups(context, DB_NAME); // Clear the backups
            }
        }
        mDatabase = this.getWritableDatabase();
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    }

    public void openDatabase() throws SQLException {
        mDatabase = this.getWritableDatabase();
    }

    //<<<<<<<<<< ADDED to allow some bookmarks to be added
    public long addBookMark(long wordid) {
        ContentValues cv = new ContentValues();
        cv.put(DatabaseHelper.COL_WORID,wordid);
        return mDatabase.insert(DatabaseHelper.TABLE_BOOKMARK,null,cv);
    }

    // Added to retrieve the database name (could make DB_NAME public)
    public String getDBNAME() {
        return this.DB_NAME;
    }

    //ADDED to dump the bookmarks along with the related word and definition
    public void logBookmarksWithWord() {

        String table_part = TABLE_BOOKMARK +
                " JOIN " + TABLE_DICTIONARY +
                " ON " + COL_WORID +
                " = " + TABLE_DICTIONARY + "." + COL_ID;
        String[] columns = new String[]{TABLE_BOOKMARK + "." + COL_ID, COL_WORID, COL_WORD, COL_DEFINITION};
        Cursor csr = mDatabase.query(table_part,columns,null,null,null,null,COL_WORD);
        DatabaseUtils.dumpCursor(csr);
        csr.close();
    }

    @Override
    public synchronized void close() {
        if (mDatabase != null)
            mDatabase.close();
        super.close();
    }
}

Hai phiên bản cơ sở dữ liệu giống nhau đã được sử dụng như câu trả lời trước. Tuy nhiên, hoạt động mời gọi đã thêm mã bổ sung vào a) thêm một số dấu trang khi DB được sao chép từ thư mục nội dung và sang b) luôn xuất các dấu trang vào nhật ký (để hiển thị chúng được giữ lại).

Hoạt động mời gọi được sử dụng là:-

public class MainActivity extends AppCompatActivity {

    DatabaseHelper mDBHlpr;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mDBHlpr = new DatabaseHelper(this);
        Cursor csr = mDBHlpr.getWritableDatabase().query(
                DatabaseHelper.TABLE_DICTIONARY,
                null,null,null,null,null,null
        );
        DatabaseUtils.dumpCursor(csr);
        //<<<<<<<<<< ADDED CODE
        // Add a couple of bookmarks only if database is copied for testing
        if (DatabaseUtils.queryNumEntries(mDBHlpr.mDatabase,DatabaseHelper.TABLE_BOOKMARK) < 1) {
            mDBHlpr.addBookMark(1);
            mDBHlpr.addBookMark(3);
        }
        // Always dump the bookmarks to the log
        mDBHlpr.logBookmarksWithWord();
        //<<<<<<<<<< END OF ADDED CODE
        csr.close();
    }
}
  • Lưu ý rằng giả định đã được đưa ra rằng bảng dấu trang, mặc dù nó trống (không cần thiết) tồn tại trong cơ sở dữ liệu đã có từ trước. Nếu nó không tồn tại thì điều này sẽ không thành công.

Thử nghiệm / Kết quả

Chạy 1

Lần chạy này dành cho cài đặt mới của Ứng dụng và DB_VERSION là 1 (do đó, cơ sở dữ liệu xuất hiện trước (phiên bản ban đầu) được sao chép từ thư mục nội dung).

04-22 18:06:17.603 8734-8734/? D/DBVERSION: The Database Version (as hard coded) is 1
04-22 18:06:17.603 8734-8734/? D/DBVERSION: The Database Version (as per the database file) is -666666666
04-22 18:06:17.603 8734-8734/? D/DBPATH: DB Path is /data/user/0/m.example.so55711282dictionary/databases/dictionary.db
04-22 18:06:17.603 8734-8734/? D/COPYDATABASE: Initiated Copy of the database file dictionary.db from the assets folder.
04-22 18:06:17.603 8734-8734/? D/COPYDATABASE: Asset file dictionary.db found so attmepting to copy to /data/user/0/m.example.so55711282dictionary/databases/dictionary.db
04-22 18:06:17.604 8734-8734/? D/COPYDATABASE: Attempting copy of block 1 which has 4096 bytes.
04-22 18:06:17.604 8734-8734/? D/COPYDATABASE: Attempting copy of block 2 which has 4096 bytes.
04-22 18:06:17.604 8734-8734/? D/COPYDATABASE: Attempting copy of block 3 which has 4096 bytes.
04-22 18:06:17.604 8734-8734/? D/COPYDATABASE: Finished copying Database dictionary.db from the assets folder, to  /data/user/0/m.example.so55711282dictionary/databases/dictionary.db12288were copied, in 3 blocks of size 4096.
04-22 18:06:17.604 8734-8734/? D/COPYDATABASE: All Streams have been flushed and closed.
04-22 18:06:17.625 8734-8734/? I/System.out: >>>>> Dumping cursor [email protected]
04-22 18:06:17.625 8734-8734/? I/System.out: 0 {
04-22 18:06:17.625 8734-8734/? I/System.out:    id=1
04-22 18:06:17.625 8734-8734/? I/System.out:    word=Apple
04-22 18:06:17.625 8734-8734/? I/System.out:    definition=Thing that drops from an Apple Tree.
04-22 18:06:17.625 8734-8734/? I/System.out: }
04-22 18:06:17.625 8734-8734/? I/System.out: 1 {
04-22 18:06:17.625 8734-8734/? I/System.out:    id=2
04-22 18:06:17.625 8734-8734/? I/System.out:    word=Bucket
04-22 18:06:17.625 8734-8734/? I/System.out:    definition=Hand held container with carrying hanlde.
04-22 18:06:17.625 8734-8734/? I/System.out: }
04-22 18:06:17.625 8734-8734/? I/System.out: <<<<<


04-22 18:06:17.631 8734-8734/? D/BOOKMARKDUMP: Dumping the bookmarks table to the log.
04-22 18:06:17.631 8734-8734/? I/System.out: >>>>> Dumping cursor [email protected]
04-22 18:06:17.631 8734-8734/? I/System.out: 0 {
04-22 18:06:17.631 8734-8734/? I/System.out:    id=1
04-22 18:06:17.631 8734-8734/? I/System.out:    wordid=1
04-22 18:06:17.631 8734-8734/? I/System.out:    word=Apple
04-22 18:06:17.631 8734-8734/? I/System.out:    definition=Thing that drops from an Apple Tree.
04-22 18:06:17.631 8734-8734/? I/System.out: }
04-22 18:06:17.631 8734-8734/? I/System.out: <<<<<

Chạy 2

Chỉ cần chạy lại không có thay đổi nào, vì vậy không tồn tại dấu trang bản sao.

04-22 18:40:56.304 8858-8858/m.example.so55711282dictionary D/DBVERSION: The Database Version (as hard coded) is 1
04-22 18:40:56.304 8858-8858/m.example.so55711282dictionary D/DBVERSION: The Database Version (as per the database file) is 1
04-22 18:40:56.304 8858-8858/m.example.so55711282dictionary D/DBPATH: DB Path is /data/user/0/m.example.so55711282dictionary/databases/dictionary.db
04-22 18:40:56.308 8858-8858/m.example.so55711282dictionary I/System.out: >>>>> Dumping cursor [email protected]
04-22 18:40:56.308 8858-8858/m.example.so55711282dictionary I/System.out: 0 {
04-22 18:40:56.308 8858-8858/m.example.so55711282dictionary I/System.out:    id=1
04-22 18:40:56.308 8858-8858/m.example.so55711282dictionary I/System.out:    word=Apple
04-22 18:40:56.308 8858-8858/m.example.so55711282dictionary I/System.out:    definition=Thing that drops from an Apple Tree.
04-22 18:40:56.308 8858-8858/m.example.so55711282dictionary I/System.out: }
04-22 18:40:56.308 8858-8858/m.example.so55711282dictionary I/System.out: 1 {
04-22 18:40:56.309 8858-8858/m.example.so55711282dictionary I/System.out:    id=2
04-22 18:40:56.309 8858-8858/m.example.so55711282dictionary I/System.out:    word=Bucket
04-22 18:40:56.309 8858-8858/m.example.so55711282dictionary I/System.out:    definition=Hand held container with carrying hanlde.
04-22 18:40:56.309 8858-8858/m.example.so55711282dictionary I/System.out: }
04-22 18:40:56.309 8858-8858/m.example.so55711282dictionary I/System.out: <<<<<
04-22 18:40:56.309 8858-8858/m.example.so55711282dictionary D/BOOKMARKDUMP: Dumping the bookmarks table to the log.
04-22 18:40:56.309 8858-8858/m.example.so55711282dictionary I/System.out: >>>>> Dumping cursor [email protected]
04-22 18:40:56.309 8858-8858/m.example.so55711282dictionary I/System.out: 0 {
04-22 18:40:56.309 8858-8858/m.example.so55711282dictionary I/System.out:    id=1
04-22 18:40:56.309 8858-8858/m.example.so55711282dictionary I/System.out:    wordid=1
04-22 18:40:56.309 8858-8858/m.example.so55711282dictionary I/System.out:    word=Apple
04-22 18:40:56.309 8858-8858/m.example.so55711282dictionary I/System.out:    definition=Thing that drops from an Apple Tree.
04-22 18:40:56.309 8858-8858/m.example.so55711282dictionary I/System.out: }
04-22 18:40:56.309 8858-8858/m.example.so55711282dictionary I/System.out: <<<<<

Chạy 3

Phiên bản cơ sở dữ liệu mới được giới thiệu DB_VERSION đã thay đổi thành 2 (thêm một số từ nên dấu trang cho từ có id 3 có một từ liên quan). Đã sao chép phiên bản DB mới. Hai dấu trang đã được giữ lại.

04-22 18:44:58.749 8975-8975/? D/DBVERSION: The Database Version (as hard coded) is 2
04-22 18:44:58.749 8975-8975/? D/DBVERSION: The Database Version (as per the database file) is 1
04-22 18:44:58.749 8975-8975/? D/DBPATH: DB Path is /data/user/0/m.example.so55711282dictionary/databases/dictionary.db
04-22 18:44:58.749 8975-8975/? D/DBPATH: DB Path is /data/user/0/m.example.so55711282dictionary/databases/dictionary.db
04-22 18:44:58.750 8975-8975/? D/COPYDATABASE: Initiated Copy of the database file dictionary.db from the assets folder.
04-22 18:44:58.750 8975-8975/? D/COPYDATABASE: Asset file dictionary.db found so attmepting to copy to /data/user/0/m.example.so55711282dictionary/databases/dictionary.db
04-22 18:44:58.750 8975-8975/? D/COPYDATABASE: Attempting copy of block 1 which has 4096 bytes.
04-22 18:44:58.750 8975-8975/? D/COPYDATABASE: Attempting copy of block 2 which has 4096 bytes.
04-22 18:44:58.750 8975-8975/? D/COPYDATABASE: Attempting copy of block 3 which has 4096 bytes.
04-22 18:44:58.750 8975-8975/? D/COPYDATABASE: Finished copying Database dictionary.db from the assets folder, to  /data/user/0/m.example.so55711282dictionary/databases/dictionary.db12288were copied, in 3 blocks of size 4096.
04-22 18:44:58.750 8975-8975/? D/COPYDATABASE: All Streams have been flushed and closed.
04-22 18:44:58.783 8975-8975/? I/System.out: >>>>> Dumping cursor [email protected]
04-22 18:44:58.784 8975-8975/? I/System.out: 0 {
04-22 18:44:58.784 8975-8975/? I/System.out:    id=1
04-22 18:44:58.784 8975-8975/? I/System.out:    word=Apple
04-22 18:44:58.784 8975-8975/? I/System.out:    definition=Thing that drops from an Apple Tree.
04-22 18:44:58.784 8975-8975/? I/System.out: }
04-22 18:44:58.784 8975-8975/? I/System.out: 1 {
04-22 18:44:58.784 8975-8975/? I/System.out:    id=2
04-22 18:44:58.784 8975-8975/? I/System.out:    word=Bucket
04-22 18:44:58.784 8975-8975/? I/System.out:    definition=Hand held container with carrying hanlde.
04-22 18:44:58.784 8975-8975/? I/System.out: }
04-22 18:44:58.784 8975-8975/? I/System.out: 2 {
04-22 18:44:58.784 8975-8975/? I/System.out:    id=3
04-22 18:44:58.784 8975-8975/? I/System.out:    word=Yelllow
04-22 18:44:58.784 8975-8975/? I/System.out:    definition=A colour.
04-22 18:44:58.784 8975-8975/? I/System.out: }
04-22 18:44:58.784 8975-8975/? I/System.out: 3 {
04-22 18:44:58.784 8975-8975/? I/System.out:    id=4
04-22 18:44:58.784 8975-8975/? I/System.out:    word=Zebra
04-22 18:44:58.784 8975-8975/? I/System.out:    definition=A balck and white, horse-like animal.
04-22 18:44:58.784 8975-8975/? I/System.out: }
04-22 18:44:58.784 8975-8975/? I/System.out: <<<<<
04-22 18:44:58.784 8975-8975/? D/BOOKMARKDUMP: Dumping the bookmarks table to the log.
04-22 18:44:58.785 8975-8975/? I/System.out: >>>>> Dumping cursor [email protected]
04-22 18:44:58.785 8975-8975/? I/System.out: 0 {
04-22 18:44:58.785 8975-8975/? I/System.out:    id=1
04-22 18:44:58.785 8975-8975/? I/System.out:    wordid=1
04-22 18:44:58.785 8975-8975/? I/System.out:    word=Apple
04-22 18:44:58.785 8975-8975/? I/System.out:    definition=Thing that drops from an Apple Tree.
04-22 18:44:58.785 8975-8975/? I/System.out: }
04-22 18:44:58.785 8975-8975/? I/System.out: 1 {
04-22 18:44:58.785 8975-8975/? I/System.out:    id=2
04-22 18:44:58.785 8975-8975/? I/System.out:    wordid=3
04-22 18:44:58.785 8975-8975/? I/System.out:    word=Yelllow
04-22 18:44:58.785 8975-8975/? I/System.out:    definition=A colour.
04-22 18:44:58.785 8975-8975/? I/System.out: }
04-22 18:44:58.785 8975-8975/? I/System.out: <<<<<

CHẠY 4

Không có gì thay đổi, vì vậy không có dấu trang sao chép DB nào vẫn được giữ lại.

04-22 18:47:19.300 9047-9047/m.example.so55711282dictionary D/DBVERSION: The Database Version (as hard coded) is 2
04-22 18:47:19.300 9047-9047/m.example.so55711282dictionary D/DBVERSION: The Database Version (as per the database file) is 2
04-22 18:47:19.300 9047-9047/m.example.so55711282dictionary D/DBPATH: DB Path is /data/user/0/m.example.so55711282dictionary/databases/dictionary.db
04-22 18:47:19.302 9047-9047/m.example.so55711282dictionary I/System.out: >>>>> Dumping cursor [email protected]
04-22 18:47:19.302 9047-9047/m.example.so55711282dictionary I/System.out: 0 {
04-22 18:47:19.302 9047-9047/m.example.so55711282dictionary I/System.out:    id=1
04-22 18:47:19.302 9047-9047/m.example.so55711282dictionary I/System.out:    word=Apple
04-22 18:47:19.302 9047-9047/m.example.so55711282dictionary I/System.out:    definition=Thing that drops from an Apple Tree.
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out: }
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out: 1 {
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    id=2
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    word=Bucket
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    definition=Hand held container with carrying hanlde.
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out: }
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out: 2 {
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    id=3
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    word=Yelllow
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    definition=A colour.
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out: }
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out: 3 {
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    id=4
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    word=Zebra
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    definition=A balck and white, horse-like animal.
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out: }
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out: <<<<<
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary D/BOOKMARKDUMP: Dumping the bookmarks table to the log.
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out: >>>>> Dumping cursor [email protected]
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out: 0 {
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    id=1
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    wordid=1
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    word=Apple
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    definition=Thing that drops from an Apple Tree.
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out: }
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out: 1 {
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    id=2
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    wordid=3
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    word=Yelllow
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out:    definition=A colour.
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out: }
04-22 18:47:19.303 9047-9047/m.example.so55711282dictionary I/System.out: <<<<<

CHẠY 5

Đã gỡ cài đặt ứng dụng. Đã sử dụng phiên bản mới. Dấu trang được thêm làm phiên bản DB BUT mới nhất, tức là 2

04-22 18:50:55.297 9243-9243/m.example.so55711282dictionary D/DBVERSION: The Database Version (as hard coded) is 2
04-22 18:50:55.297 9243-9243/m.example.so55711282dictionary D/DBVERSION: The Database Version (as per the database file) is -666666666
04-22 18:50:55.297 9243-9243/m.example.so55711282dictionary D/DBPATH: DB Path is /data/user/0/m.example.so55711282dictionary/databases/dictionary.db
04-22 18:50:55.297 9243-9243/m.example.so55711282dictionary D/COPYDATABASE: Initiated Copy of the database file dictionary.db from the assets folder.
04-22 18:50:55.297 9243-9243/m.example.so55711282dictionary D/COPYDATABASE: Asset file dictionary.db found so attmepting to copy to /data/user/0/m.example.so55711282dictionary/databases/dictionary.db
04-22 18:50:55.297 9243-9243/m.example.so55711282dictionary D/COPYDATABASE: Attempting copy of block 1 which has 4096 bytes.
04-22 18:50:55.298 9243-9243/m.example.so55711282dictionary D/COPYDATABASE: Attempting copy of block 2 which has 4096 bytes.
04-22 18:50:55.298 9243-9243/m.example.so55711282dictionary D/COPYDATABASE: Attempting copy of block 3 which has 4096 bytes.
04-22 18:50:55.298 9243-9243/m.example.so55711282dictionary D/COPYDATABASE: Finished copying Database dictionary.db from the assets folder, to  /data/user/0/m.example.so55711282dictionary/databases/dictionary.db12288were copied, in 3 blocks of size 4096.
04-22 18:50:55.298 9243-9243/m.example.so55711282dictionary D/COPYDATABASE: All Streams have been flushed and closed.
04-22 18:50:55.320 9243-9243/m.example.so55711282dictionary I/System.out: >>>>> Dumping cursor [email protected]
04-22 18:50:55.320 9243-9243/m.example.so55711282dictionary I/System.out: 0 {
04-22 18:50:55.320 9243-9243/m.example.so55711282dictionary I/System.out:    id=1
04-22 18:50:55.320 9243-9243/m.example.so55711282dictionary I/System.out:    word=Apple
04-22 18:50:55.320 9243-9243/m.example.so55711282dictionary I/System.out:    definition=Thing that drops from an Apple Tree.
04-22 18:50:55.320 9243-9243/m.example.so55711282dictionary I/System.out: }
04-22 18:50:55.320 9243-9243/m.example.so55711282dictionary I/System.out: 1 {
04-22 18:50:55.320 9243-9243/m.example.so55711282dictionary I/System.out:    id=2
04-22 18:50:55.320 9243-9243/m.example.so55711282dictionary I/System.out:    word=Bucket
04-22 18:50:55.321 9243-9243/m.example.so55711282dictionary I/System.out:    definition=Hand held container with carrying hanlde.
04-22 18:50:55.321 9243-9243/m.example.so55711282dictionary I/System.out: }
04-22 18:50:55.321 9243-9243/m.example.so55711282dictionary I/System.out: 2 {
04-22 18:50:55.321 9243-9243/m.example.so55711282dictionary I/System.out:    id=3
04-22 18:50:55.321 9243-9243/m.example.so55711282dictionary I/System.out:    word=Yelllow
04-22 18:50:55.321 9243-9243/m.example.so55711282dictionary I/System.out:    definition=A colour.
04-22 18:50:55.321 9243-9243/m.example.so55711282dictionary I/System.out: }
04-22 18:50:55.321 9243-9243/m.example.so55711282dictionary I/System.out: 3 {
04-22 18:50:55.321 9243-9243/m.example.so55711282dictionary I/System.out:    id=4
04-22 18:50:55.321 9243-9243/m.example.so55711282dictionary I/System.out:    word=Zebra
04-22 18:50:55.321 9243-9243/m.example.so55711282dictionary I/System.out:    definition=A balck and white, horse-like animal.
04-22 18:50:55.321 9243-9243/m.example.so55711282dictionary I/System.out: }
04-22 18:50:55.321 9243-9243/m.example.so55711282dictionary I/System.out: <<<<<
04-22 18:50:55.328 9243-9243/m.example.so55711282dictionary D/BOOKMARKDUMP: Dumping the bookmarks table to the log.
04-22 18:50:55.328 9243-9243/m.example.so55711282dictionary I/System.out: >>>>> Dumping cursor [email protected]
04-22 18:50:55.328 9243-9243/m.example.so55711282dictionary I/System.out: 0 {
04-22 18:50:55.328 9243-9243/m.example.so55711282dictionary I/System.out:    id=1
04-22 18:50:55.328 9243-9243/m.example.so55711282dictionary I/System.out:    wordid=1
04-22 18:50:55.328 9243-9243/m.example.so55711282dictionary I/System.out:    word=Apple
04-22 18:50:55.328 9243-9243/m.example.so55711282dictionary I/System.out:    definition=Thing that drops from an Apple Tree.
04-22 18:50:55.328 9243-9243/m.example.so55711282dictionary I/System.out: }
04-22 18:50:55.328 9243-9243/m.example.so55711282dictionary I/System.out: 1 {
04-22 18:50:55.328 9243-9243/m.example.so55711282dictionary I/System.out:    id=2
04-22 18:50:55.328 9243-9243/m.example.so55711282dictionary I/System.out:    wordid=3
04-22 18:50:55.328 9243-9243/m.example.so55711282dictionary I/System.out:    word=Yelllow
04-22 18:50:55.328 9243-9243/m.example.so55711282dictionary I/System.out:    definition=A colour.
04-22 18:50:55.328 9243-9243/m.example.so55711282dictionary I/System.out: }
04-22 18:50:55.328 9243-9243/m.example.so55711282dictionary I/System.out: <<<<<


  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Trả lại dữ liệu đã tìm kiếm từ sqlite

  2. Cách / thứ tự được đề xuất để đọc dữ liệu từ một dịch vụ web, phân tích cú pháp dữ liệu đó và chèn nó vào db SQLite

  3. lỗi phòng:Các cột được trả về bởi truy vấn không có tên trường

  4. BẢNG DROP SQLite

  5. Lưu trữ vị trí mới của các mục RecyclerView trong SQLite sau khi được kéo và thả