Example usage for com.badlogic.gdx.sql SQLiteGdxDatabase closeDatabase

List of usage examples for com.badlogic.gdx.sql SQLiteGdxDatabase closeDatabase

Introduction

In this page you can find the example usage for com.badlogic.gdx.sql SQLiteGdxDatabase closeDatabase.

Prototype

public void closeDatabase() throws SQLiteGdxException;

Source Link

Document

Closes the opened database and releases all the resources related to this database.

Usage

From source file:de.longri.cachebox3.sqlite.Database.java

License:Open Source License

public static int getCacheCountInDB(String absolutePath) {
    try {//from ww  w .j  a  va 2 s.  co  m
        SQLiteGdxDatabase tempDB = SQLiteGdxDatabaseFactory.getNewDatabase(Gdx.files.absolute(absolutePath));
        tempDB.openOrCreateDatabase();
        SQLiteGdxDatabaseCursor result = tempDB.rawQuery("SELECT COUNT(*) FROM caches", null);
        result.moveToFirst();
        int count = result.getInt(1);
        result.close();
        tempDB.closeDatabase();
        return count;
    } catch (Exception exc) {
        return -1;
    }
}