Compare commits
No commits in common. "e1beced72c7f3016408ced60340bbfa2d491bc78" and "3a794874dcd9dcd32fe8799a968b807ec7236393" have entirely different histories.
e1beced72c
...
3a794874dc
3 changed files with 27 additions and 55 deletions
48
Cargo.lock
generated
48
Cargo.lock
generated
|
@ -8,14 +8,9 @@ checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ahash"
|
name = "ahash"
|
||||||
version = "0.7.4"
|
version = "0.4.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "43bb833f0bf979d8475d38fbf09ed3b8a55e1885fe93ad3f93239fc6a4f17b98"
|
checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e"
|
||||||
dependencies = [
|
|
||||||
"getrandom",
|
|
||||||
"once_cell",
|
|
||||||
"version_check",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
|
@ -101,31 +96,20 @@ dependencies = [
|
||||||
"miniz_oxide",
|
"miniz_oxide",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "getrandom"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if 1.0.0",
|
|
||||||
"libc",
|
|
||||||
"wasi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.11.2"
|
version = "0.9.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashlink"
|
name = "hashlink"
|
||||||
version = "0.7.0"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf"
|
checksum = "d99cf782f0dc4372d26846bec3de7804ceb5df083c2d4462c0b8d2330e894fa8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
]
|
]
|
||||||
|
@ -138,9 +122,9 @@ checksum = "265d751d31d6780a3f956bb5b8022feba2d94eeee5a84ba64f4212eedca42213"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libsqlite3-sys"
|
name = "libsqlite3-sys"
|
||||||
version = "0.22.2"
|
version = "0.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "290b64917f8b0cb885d9de0f9959fe1f775d7fa12f1da2db9001c1c8ab60f89d"
|
checksum = "64d31059f22935e6c31830db5249ba2b7ecd54fd73a9909286f0a67aa55c2fbd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
|
@ -162,12 +146,6 @@ dependencies = [
|
||||||
"adler32",
|
"adler32",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "once_cell"
|
|
||||||
version = "1.7.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pbdbfixer"
|
name = "pbdbfixer"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
|
@ -212,9 +190,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rusqlite"
|
name = "rusqlite"
|
||||||
version = "0.25.3"
|
version = "0.24.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "57adcf67c8faaf96f3248c2a7b419a0dbc52ebe36ba83dd57fe83827c1ea4eb3"
|
checksum = "d5f38ee71cbab2c827ec0ac24e76f82eca723cee92c509a65f67dee393c25112"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"fallible-iterator",
|
"fallible-iterator",
|
||||||
|
@ -285,12 +263,6 @@ version = "0.2.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
|
checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "version_check"
|
|
||||||
version = "0.9.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.10.0+wasi-snapshot-preview1"
|
version = "0.10.0+wasi-snapshot-preview1"
|
||||||
|
|
|
@ -11,5 +11,5 @@ zip = "0.5"
|
||||||
quick-xml = "0.22"
|
quick-xml = "0.22"
|
||||||
|
|
||||||
[dependencies.rusqlite]
|
[dependencies.rusqlite]
|
||||||
version = "0.25"
|
version = "0.24"
|
||||||
features = ["bundled"]
|
features = ["bundled"]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use rusqlite::{named_params, Connection, Transaction};
|
use rusqlite::{named_params, Connection, Transaction, NO_PARAMS};
|
||||||
|
|
||||||
use crate::epub;
|
use crate::epub;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ fn get_epubs_from_database(tx: &Transaction) -> Vec<BookEntry> {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut rows = stmt.query([]).unwrap();
|
let mut rows = stmt.query(NO_PARAMS).unwrap();
|
||||||
|
|
||||||
while let Some(row) = rows.next().unwrap() {
|
while let Some(row) = rows.next().unwrap() {
|
||||||
let book_id: i32 = row.get(0).unwrap();
|
let book_id: i32 = row.get(0).unwrap();
|
||||||
|
@ -79,44 +79,44 @@ fn remove_ghost_books_from_db(tx: &Transaction) -> usize {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let num = stmt.execute([]).unwrap();
|
let num = stmt.execute(NO_PARAMS).unwrap();
|
||||||
|
|
||||||
tx.execute(
|
tx.execute(
|
||||||
r#"DELETE FROM books_settings WHERE bookid NOT IN ( SELECT id FROM books_impl )"#,
|
r#"DELETE FROM books_settings WHERE bookid NOT IN ( SELECT id FROM books_impl )"#,
|
||||||
[],
|
NO_PARAMS,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let version: i32 = tx
|
let version: i32 = tx
|
||||||
.query_row(r#"SELECT id FROM version"#, [], |r| r.get(0))
|
.query_row(r#"SELECT id FROM version"#, NO_PARAMS, |r| r.get(0))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
if version >= 37 {
|
if version >= 37 {
|
||||||
tx.execute(
|
tx.execute(
|
||||||
r#"DELETE FROM books_fast_hashes WHERE book_id NOT IN ( SELECT id FROM books_impl )"#,
|
r#"DELETE FROM books_fast_hashes WHERE book_id NOT IN ( SELECT id FROM books_impl )"#,
|
||||||
[],
|
NO_PARAMS,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
} else {
|
} else {
|
||||||
tx.execute(
|
tx.execute(
|
||||||
r#"DELETE FROM books_uids WHERE book_id NOT IN ( SELECT id FROM books_impl )"#,
|
r#"DELETE FROM books_uids WHERE book_id NOT IN ( SELECT id FROM books_impl )"#,
|
||||||
[],
|
NO_PARAMS,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
tx.execute(
|
tx.execute(
|
||||||
r#"DELETE FROM bookshelfs_books WHERE bookid NOT IN ( SELECT id FROM books_impl )"#,
|
r#"DELETE FROM bookshelfs_books WHERE bookid NOT IN ( SELECT id FROM books_impl )"#,
|
||||||
[],
|
NO_PARAMS,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
tx.execute(
|
tx.execute(
|
||||||
r#"DELETE FROM booktogenre WHERE bookid NOT IN ( SELECT id FROM books_impl )"#,
|
r#"DELETE FROM booktogenre WHERE bookid NOT IN ( SELECT id FROM books_impl )"#,
|
||||||
[],
|
NO_PARAMS,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
tx.execute(
|
tx.execute(
|
||||||
r#"DELETE FROM social WHERE bookid NOT IN ( SELECT id FROM books_impl )"#,
|
r#"DELETE FROM social WHERE bookid NOT IN ( SELECT id FROM books_impl )"#,
|
||||||
[],
|
NO_PARAMS,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ pub fn fix_db_entries() -> Statistics {
|
||||||
let mut stmt = tx
|
let mut stmt = tx
|
||||||
.prepare("UPDATE books_impl SET firstauthor = :file_as WHERE id = :book_id")
|
.prepare("UPDATE books_impl SET firstauthor = :file_as WHERE id = :book_id")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
stmt.execute(
|
stmt.execute_named(
|
||||||
named_params![":file_as": firstauthors.join(" & "), ":book_id": entry.id],
|
named_params![":file_as": firstauthors.join(" & "), ":book_id": entry.id],
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -190,7 +190,7 @@ pub fn fix_db_entries() -> Statistics {
|
||||||
let mut stmt = tx
|
let mut stmt = tx
|
||||||
.prepare("UPDATE books_impl SET first_author_letter = :first_letter WHERE id = :book_id")
|
.prepare("UPDATE books_impl SET first_author_letter = :first_letter WHERE id = :book_id")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
stmt.execute(
|
stmt.execute_named(
|
||||||
named_params![":first_letter": first_author_letter,":book_id": entry.id],
|
named_params![":first_letter": first_author_letter,":book_id": entry.id],
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -209,7 +209,7 @@ pub fn fix_db_entries() -> Statistics {
|
||||||
let mut stmt = tx
|
let mut stmt = tx
|
||||||
.prepare("UPDATE books_impl SET author = :authors WHERE id = :book_id")
|
.prepare("UPDATE books_impl SET author = :authors WHERE id = :book_id")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
stmt.execute(
|
stmt.execute_named(
|
||||||
named_params![":authors": authornames.join(", "), ":book_id": entry.id],
|
named_params![":authors": authornames.join(", "), ":book_id": entry.id],
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -221,7 +221,7 @@ pub fn fix_db_entries() -> Statistics {
|
||||||
let mut stmt = tx
|
let mut stmt = tx
|
||||||
.prepare(r#"INSERT INTO genres (name) SELECT :genre ON CONFLICT DO NOTHING"#)
|
.prepare(r#"INSERT INTO genres (name) SELECT :genre ON CONFLICT DO NOTHING"#)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
stmt.execute(named_params![":genre": &epub_metadata.genre])
|
stmt.execute_named(named_params![":genre": &epub_metadata.genre])
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let mut stmt = tx
|
let mut stmt = tx
|
||||||
.prepare(
|
.prepare(
|
||||||
|
@ -233,7 +233,7 @@ pub fn fix_db_entries() -> Statistics {
|
||||||
ON CONFLICT DO NOTHING"#,
|
ON CONFLICT DO NOTHING"#,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
stmt.execute(
|
stmt.execute_named(
|
||||||
named_params![":bookid": &entry.id, ":genre": &epub_metadata.genre],
|
named_params![":bookid": &entry.id, ":genre": &epub_metadata.genre],
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -245,7 +245,7 @@ pub fn fix_db_entries() -> Statistics {
|
||||||
let mut stmt = tx
|
let mut stmt = tx
|
||||||
.prepare("UPDATE books_impl SET series = :series, numinseries = :series_index WHERE id = :book_id")
|
.prepare("UPDATE books_impl SET series = :series, numinseries = :series_index WHERE id = :book_id")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
stmt.execute(
|
stmt.execute_named(
|
||||||
named_params![":series": &epub_metadata.series.name, ":series_index": &epub_metadata.series.index, ":book_id": entry.id],
|
named_params![":series": &epub_metadata.series.name, ":series_index": &epub_metadata.series.index, ":book_id": entry.id],
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
Loading…
Reference in a new issue