use of android.database.CursorWindow in project android_frameworks_base by crdroidandroid.
the class CursorWindowTest method testConstructor_WithName.
@SmallTest
public void testConstructor_WithName() {
CursorWindow window = new CursorWindow("MyWindow");
assertEquals("MyWindow", window.getName());
assertEquals(0, window.getStartPosition());
window.close();
}
use of android.database.CursorWindow in project android_frameworks_base by crdroidandroid.
the class CursorWindowTest method testConstructorWithNullName.
@SmallTest
public void testConstructorWithNullName() {
CursorWindow window = new CursorWindow(null);
assertEquals("<unnamed>", window.getName());
assertEquals(0, window.getStartPosition());
window.close();
}
use of android.database.CursorWindow in project android_frameworks_base by AOSPA.
the class SQLiteConnection method collectDbStats.
/**
* Collects statistics about database connection memory usage.
*
* @param dbStatsList The list to populate.
*/
void collectDbStats(ArrayList<DbStats> dbStatsList) {
// Get information about the main database.
int lookaside = nativeGetDbLookaside(mConnectionPtr);
long pageCount = 0;
long pageSize = 0;
try {
pageCount = executeForLong("PRAGMA page_count;", null, null);
pageSize = executeForLong("PRAGMA page_size;", null, null);
} catch (SQLiteException ex) {
// Ignore.
}
dbStatsList.add(getMainDbStatsUnsafe(lookaside, pageCount, pageSize));
// Get information about attached databases.
// We ignore the first row in the database list because it corresponds to
// the main database which we have already described.
CursorWindow window = new CursorWindow("collectDbStats");
try {
executeForCursorWindow("PRAGMA database_list;", null, window, 0, 0, false, null);
for (int i = 1; i < window.getNumRows(); i++) {
String name = window.getString(i, 1);
String path = window.getString(i, 2);
pageCount = 0;
pageSize = 0;
try {
pageCount = executeForLong("PRAGMA " + name + ".page_count;", null, null);
pageSize = executeForLong("PRAGMA " + name + ".page_size;", null, null);
} catch (SQLiteException ex) {
// Ignore.
}
String label = " (attached) " + name;
if (!path.isEmpty()) {
label += ": " + path;
}
dbStatsList.add(new DbStats(label, pageCount, pageSize, 0, 0, 0, 0));
}
} catch (SQLiteException ex) {
// Ignore.
} finally {
window.close();
}
}
use of android.database.CursorWindow in project android_frameworks_base by AOSPA.
the class CursorWindowTest method testValues.
@SmallTest
public void testValues() {
CursorWindow window = new CursorWindow("MyWindow");
doTestValues(window);
window.close();
}
use of android.database.CursorWindow in project android_frameworks_base by DirtyUnicorns.
the class SQLiteConnection method collectDbStats.
/**
* Collects statistics about database connection memory usage.
*
* @param dbStatsList The list to populate.
*/
void collectDbStats(ArrayList<DbStats> dbStatsList) {
// Get information about the main database.
int lookaside = nativeGetDbLookaside(mConnectionPtr);
long pageCount = 0;
long pageSize = 0;
try {
pageCount = executeForLong("PRAGMA page_count;", null, null);
pageSize = executeForLong("PRAGMA page_size;", null, null);
} catch (SQLiteException ex) {
// Ignore.
}
dbStatsList.add(getMainDbStatsUnsafe(lookaside, pageCount, pageSize));
// Get information about attached databases.
// We ignore the first row in the database list because it corresponds to
// the main database which we have already described.
CursorWindow window = new CursorWindow("collectDbStats");
try {
executeForCursorWindow("PRAGMA database_list;", null, window, 0, 0, false, null);
for (int i = 1; i < window.getNumRows(); i++) {
String name = window.getString(i, 1);
String path = window.getString(i, 2);
pageCount = 0;
pageSize = 0;
try {
pageCount = executeForLong("PRAGMA " + name + ".page_count;", null, null);
pageSize = executeForLong("PRAGMA " + name + ".page_size;", null, null);
} catch (SQLiteException ex) {
// Ignore.
}
String label = " (attached) " + name;
if (!path.isEmpty()) {
label += ": " + path;
}
dbStatsList.add(new DbStats(label, pageCount, pageSize, 0, 0, 0, 0));
}
} catch (SQLiteException ex) {
// Ignore.
} finally {
window.close();
}
}
Aggregations