Yoann Hercouet Yoann Hercouet - 1 month ago 10
Android Question

How to use PRAGMA integrity_check for attached databases?

I use an SQLITE database in my apps, but I sometimes need to attach another one temporarily in order to exchange data.

I first use:

ATTACH DATABASE db/path AS db


Then I use the following to check the integrity:

PRAGMA integrity_check


The problem is it seems to be checking only the main database, not the databases I attached temporarily.

Is there a way to check all the databases?

CL. CL.
Answer

As documented in the documentation, you can put the database name before the pragma name:

PRAGMA db.integrity_check;