Version of SQLite used in Android?

后端 未结 5 1582
悲哀的现实
悲哀的现实 2020-11-21 22:55

What is the version of SQLite used in Android?

Reason: I\'m wondering how to handle schema migrations. The newer SQLite versions support an \"ALTER TABLE\" SQL comma

5条回答
  •  隐瞒了意图╮
    2020-11-21 23:37

    Although the documentation gives 3.4.0 as reference number, if you execute the following sql, you'll notice that there is a much higher number of SQlite installed:

    Cursor cursor = SQLiteDatabase.openOrCreateDatabase(":memory:", null).rawQuery("select sqlite_version() AS sqlite_version", null);
    String sqliteVersion = "";
    while(cursor.moveToNext()){
       sqliteVersion += cursor.getString(0);
    }
    

    This is just a piece of quick, dirty code to retrieve the sqlite version. For instance on a HTC Hero with Android 2.1, I get: 3.5.9.

    On my Nexus One with Android 2.2, I even get 3.6.22.

提交回复
热议问题