jeudi 23 juillet 2015

Properly perform `integrity_check` on an SQLite database from the Xerial SQLite JDBC drive

How do I properly perform integrity_check on an SQLite database from the Xerial SQLite JDBC driver?

I tried the following query which was executed successfully and returns a ResultSet. I could not find a way to retrieve the actual status code however, nor I think this is the proper approach of doing it.

def check: List[ResultSet] = {
val stmt = con.createStatement()
val res = stmt.executeQuery("PRAGMA db.integrity_check")
val l = collection.mutable.ListBuffer[T]()
while (res.next()) {
  val tmp = block(res)
  l += tmp
}
stmt.close()
l.toList.head // contains the ResultSet
}
val result: ResultSet = check.head // a result set from performing the integrity check

Aucun commentaire:

Enregistrer un commentaire