VerifyDB runs an integrity check on the database at the given path.
(path string)
| 180 | |
| 181 | // VerifyDB runs an integrity check on the database at the given path. |
| 182 | func (e *Executor) VerifyDB(path string) error { |
| 183 | srcDB, err := db.Open(path, false, true) |
| 184 | if err != nil { |
| 185 | return err |
| 186 | } |
| 187 | defer srcDB.Close() |
| 188 | |
| 189 | res, err := srcDB.VerifyIntegrity() |
| 190 | if err != nil { |
| 191 | return err |
| 192 | } |
| 193 | if !res.OK { |
| 194 | return fmt.Errorf("database failed verification: %s", res.Issues[0]) |
| 195 | } |
| 196 | return nil |
| 197 | } |