Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/pod/hissqlite-util.pod
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ counts.

Dump all history records as text, one per line: the hash in hexadecimal,
the arrival, posting, and expiration timestamps (in seconds since epoch),
and the storage API token in hexadecimal (or C<remembered> for a token-less
entry).
and the storage API token in its usual textual form, hexadecimal surrounded
with C<@> (or C<remembered> for a token-less entry).

=item B<-h>

Expand Down
14 changes: 8 additions & 6 deletions history/hissqlite/hissqlite-util.in
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ sub count_entries {
sub dump_history {
my $statement;

# quote(token) renders a BLOB as X'...' uppercase hex, or NULL for a
# remembered entry; hex(hash) renders the hash as uppercase hex.
# hex() renders a BLOB as uppercase hex, or NULL for a remembered entry's
# missing token.
$statement = $dbh->prepare(
q{
select hex(hash), arrived, posted, expires, quote(token)
select hex(hash), arrived, posted, expires, hex(token)
from hist;
},
);
Expand All @@ -158,11 +158,13 @@ sub dump_history {
my ($hash, $arrived, $posted, $expires, $token) = @row;
$posted = defined($posted) ? $posted : '-';
$expires = defined($expires) ? $expires : '-';
if (!defined($token) || (uc($token) eq 'NULL')) {
if (!defined($token)) {
$token = 'remembered';
} else {
# quote() returns the token in the form X'...'; keep the hex part.
$token = uc(substr($token, 2, -1));
# The token column stores the raw storage API token, so its hex
# surrounded with @ is exactly INN's textual token form, as
# rendered by TokenToText() and used in a hisv6 history file.
$token = '@' . $token . '@';
}
print "$hash $arrived $posted $expires $token\n";
}
Expand Down