From 191948cf9d3a9cabb2dc1ffccfe054e090d795ae Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Mon, 15 Nov 2021 01:07:32 +0000 Subject: [PATCH] Print number of modified records on requeueing --- wpull2-requeue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wpull2-requeue b/wpull2-requeue index 9032481..71aa5c9 100755 --- a/wpull2-requeue +++ b/wpull2-requeue @@ -1,6 +1,6 @@ #!/bin/bash # Usage: wpull2-requeue [ACTION] [FILENAME] [--where] URLPATTERN_OR_WHERE -# ACTION can be 'count' (default), 'print', or 'write' +# ACTION can be 'count' (default), 'print', or 'write'. On 'write', the number of modified records is printed. # FILENAME defaults to 'wpull.db' # URLPATTERN_OR_WHERE is URLPATTERN if --where isn't used or WHERE if it is. # URLPATTERN uses SQLite's LIKE syntax with ESCAPE "\", i.e. % matches any number of characters, _ matches exactly one character, and a backslash can be used to escape these special characters. @@ -46,7 +46,7 @@ query='FROM queued_urls JOIN url_strings ON url_string_id = url_strings.id WHERE if [[ "${action}" == 'write' ]] then - sqlite3 "${filename}" 'UPDATE queued_urls SET status = "todo", try_count = 0, status_code = NULL WHERE id IN (SELECT queued_urls.id '"${query}"')' + sqlite3 "${filename}" 'UPDATE queued_urls SET status = "todo", try_count = 0, status_code = NULL WHERE id IN (SELECT queued_urls.id '"${query}"'); SELECT changes()' elif [[ "${action}" == 'print' ]] then sqlite3 "${filename}" "SELECT queued_urls.*, url_strings.* ${query}"