/core/java/android/database/sqlite/package.html

https://github.com/Evervolv/android_frameworks_base · HTML · 54 lines · 50 code · 4 blank · 0 comment · 0 complexity · 3cef97eda21c5cafba9a3140364ca46c MD5 · raw file

  1. <HTML>
  2. <BODY>
  3. Contains the SQLite database management
  4. classes that an application would use to manage its own private database.
  5. <p>
  6. Applications use these classes to manage private databases. If creating a
  7. content provider, you will probably have to use these classes to create and
  8. manage your own database to store content. See <a
  9. href="{@docRoot}guide/topics/providers/content-providers.html">Content Providers</a>
  10. to learn the conventions for implementing a content provider. If you are working
  11. with data sent to you by a provider, you do not use these SQLite classes, but
  12. instead use the generic {@link android.database} classes.
  13. <p>The Android SDK and Android emulators both include the
  14. <a href="{@docRoot}studio/command-line/sqlite3.html">sqlite3</a> command-line
  15. database tool. On your development machine, run the tool from the
  16. <code>platform-tools/</code> folder of your SDK. On the emulator, run the tool
  17. with adb shell, for example, <code>adb -e shell sqlite3</code>.
  18. <p>The version of SQLite depends on the version of Android. See the following table:
  19. <table style="width:auto;">
  20. <tr><th>Android API</th><th>SQLite Version</th></tr>
  21. <tr><td>API 31</td><td>3.32</td></tr>
  22. <tr><td>API 30</td><td>3.28</td></tr>
  23. <tr><td>API 28</td><td>3.22</td></tr>
  24. <tr><td>API 27</td><td>3.19</td></tr>
  25. <tr><td>API 26</td><td>3.18</td></tr>
  26. <tr><td>API 24</td><td>3.9</td></tr>
  27. <tr><td>API 21</td><td>3.8</td></tr>
  28. <tr><td>API 11</td><td>3.7</td></tr>
  29. <tr><td>API 8</td><td>3.6</td></tr>
  30. <tr><td>API 3</td><td>3.5</td></tr>
  31. <tr><td>API 1</td><td>3.4</td></tr>
  32. </table>
  33. <p>Some device manufacturers include different versions of SQLite on their devices.
  34. There are two ways to programmatically determine the version number.
  35. <ul>
  36. <li>If available, use the sqlite3 tool, for example:
  37. <code>adb -e shell sqlite3 --version</code>.</li>
  38. <li>Create and query an in-memory database as shown in the following code sample:
  39. <pre>
  40. String query = "select sqlite_version() AS sqlite_version";
  41. SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(":memory:", null);
  42. Cursor cursor = db.rawQuery(query, null);
  43. String sqliteVersion = "";
  44. if (cursor.moveToNext()) {
  45. sqliteVersion = cursor.getString(0);
  46. }</pre>
  47. </li>
  48. </ul>
  49. </BODY>
  50. </HTML>