use of com.ichi2.libanki.exception.UnknownDatabaseVersionException in project Anki-Android by ankidroid.
the class Storage method getDatabaseVersion.
/**
* Helper method for when the collection can't be opened
*/
public static int getDatabaseVersion(String path) throws UnknownDatabaseVersionException {
try {
if (!new File(path).exists()) {
throw new UnknownDatabaseVersionException(new FileNotFoundException(path));
}
DB db = new DB(path);
int result = db.queryScalar("SELECT ver FROM col");
db.close();
return result;
} catch (Exception e) {
Timber.w(e, "Can't open database");
throw new UnknownDatabaseVersionException(e);
}
}
Aggregations