Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 37790321 authored by Lee Shombert's avatar Lee Shombert
Browse files

Fixes to the SQLite API version table

This updates the adb command examples in the file and adds a
try/finally block in the code example.  This documentation now matches
the version being published in a QPR release.

Test: documentation only

Bug: 286485585
Change-Id: I6c7c8693f3e97d7d15a5938f944b6ac78f0e4a5b
parent f283038d
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -15,7 +15,7 @@ instead use the generic {@link android.database} classes.
<a href="{@docRoot}studio/command-line/sqlite3.html">sqlite3</a> command-line
<a href="{@docRoot}studio/command-line/sqlite3.html">sqlite3</a> command-line
database tool. On your development machine, run the tool from the
database tool. On your development machine, run the tool from the
<code>platform-tools/</code> folder of your SDK. On the emulator, run the tool
<code>platform-tools/</code> folder of your SDK. On the emulator, run the tool
with adb shell, for example, <code>adb -e shell sqlite3</code>.
with adb shell, for example, <code>adb shell sqlite3</code>.


<p>The version of SQLite depends on the version of Android. See the following table:
<p>The version of SQLite depends on the version of Android. See the following table:
<table style="width:auto;">
<table style="width:auto;">
@@ -42,15 +42,19 @@ with adb shell, for example, <code>adb -e shell sqlite3</code>.


<ul>
<ul>
  <li>If available, use the sqlite3 tool, for example:
  <li>If available, use the sqlite3 tool, for example:
    <code>adb -e shell sqlite3 --version</code>.</li>
    <code>adb shell sqlite3 --version</code>.</li>
  <li>Create and query an in-memory database as shown in the following code sample:
  <li>Create and query an in-memory database as shown in the following code sample:
    <pre>
    <pre>
    String query = "select sqlite_version() AS sqlite_version";
    String query = "select sqlite_version() AS sqlite_version";
    SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(":memory:", null);
    SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(":memory:", null);
    Cursor cursor = db.rawQuery(query, null);
    Cursor cursor = db.rawQuery(query, null);
    String sqliteVersion = "";
    String sqliteVersion = "";
    try {
        if (cursor.moveToNext()) {
        if (cursor.moveToNext()) {
            sqliteVersion = cursor.getString(0);
            sqliteVersion = cursor.getString(0);
        }
    } finally {
        cursor.close();
    }</pre>
    }</pre>
  </li>
  </li>
</ul>
</ul>