checkNotesPristine checks that none of the notes in the given book are dirty
(tx *database.DB, bookUUID string)
| 435 | |
| 436 | // checkNotesPristine checks that none of the notes in the given book are dirty |
| 437 | func checkNotesPristine(tx *database.DB, bookUUID string) (bool, error) { |
| 438 | var count int |
| 439 | if err := tx.QueryRow("SELECT count(*) FROM notes WHERE book_uuid = ? AND dirty = ?", bookUUID, true).Scan(&count); err != nil { |
| 440 | return false, errors.Wrapf(err, "counting notes that are dirty in book %s", bookUUID) |
| 441 | } |
| 442 | |
| 443 | if count > 0 { |
| 444 | return false, nil |
| 445 | } |
| 446 | |
| 447 | return true, nil |
| 448 | } |
| 449 | |
| 450 | func syncDeleteBook(tx *database.DB, bookUUID string) error { |
| 451 | var localUSN int |