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