Skip to content

Commit 111ab9a

Browse files
committed
review feedback
1 parent 0d11da9 commit 111ab9a

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/local/SQLitePersistence.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,7 @@ long getByteSize() {
205205
* @see https://www.sqlite.org/pragma.html#pragma_page_size
206206
*/
207207
private long getPageSize() {
208-
Cursor cursor = db.rawQuery("PRAGMA page_size", null);
209-
try {
210-
cursor.moveToFirst();
211-
return cursor.getLong(/*column=*/ 0);
212-
} finally {
213-
cursor.close();
214-
}
208+
return query("PRAGMA page_size").firstValue(row -> row.getLong(/*column=*/ 0));
215209
}
216210

217211
/**
@@ -221,13 +215,7 @@ private long getPageSize() {
221215
* @see https://www.sqlite.org/pragma.html#pragma_page_count.
222216
*/
223217
private long getPageCount() {
224-
Cursor cursor = db.rawQuery("PRAGMA page_count", null);
225-
try {
226-
cursor.moveToFirst();
227-
return cursor.getLong(/*column=*/ 0);
228-
} finally {
229-
cursor.close();
230-
}
218+
return query("PRAGMA page_count").firstValue(row -> row.getLong(/*column=*/ 0));
231219
}
232220

233221
/**

0 commit comments

Comments
 (0)