Skip to content

hissqlite-util: print -d tokens as @hex@ like other INN tools#362

Closed
kev009 wants to merge 1 commit into
InterNetNews:mainfrom
kev009:hissqlite-util-token
Closed

hissqlite-util: print -d tokens as @hex@ like other INN tools#362
kev009 wants to merge 1 commit into
InterNetNews:mainfrom
kev009:hissqlite-util-token

Conversation

@kev009

@kev009 kev009 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

-d used bare hex; switch to the usual @...@ form and use hex() instead of stripping quote()'s X'...' output.

-d used bare hex; switch to the usual @...@ form and use hex()
instead of stripping quote()'s X'...' output.
@Julien-Elie Julien-Elie self-assigned this Jul 16, 2026
@Julien-Elie Julien-Elie added bug Something isn't working C: history Related to history P: low Low priority labels Jul 16, 2026
@Julien-Elie Julien-Elie added this to the 2.8.0 milestone Jul 16, 2026
@Julien-Elie

Copy link
Copy Markdown
Contributor

Thanks for the change.

@Julien-Elie

Copy link
Copy Markdown
Contributor

Playing a bit with hissqlite-util, remembered entries are shown with @@.
Also, shouldn't default values for $posted and $expires be 0, as other entries without these values set are dumped as 0?

I would suggest that change, if that's OK for you:

--- a/history/hissqlite/hissqlite-util.in
+++ b/history/hissqlite/hissqlite-util.in
@@ -144,8 +144,8 @@ sub count_entries {
 sub dump_history {
     my $statement;
 
-    # hex() renders a BLOB as uppercase hex, or NULL for a remembered entry's
-    # missing token.
+    # hex() renders a BLOB as uppercase hex, or an empty string for a
+    # remembered entry's missing token.
     $statement = $dbh->prepare(
         q{
             select hex(hash), arrived, posted, expires, hex(token)
@@ -156,9 +156,9 @@ sub dump_history {
 
     while (my @row = $statement->fetchrow_array()) {
         my ($hash, $arrived, $posted, $expires, $token) = @row;
-        $posted = defined($posted) ? $posted : '-';
-        $expires = defined($expires) ? $expires : '-';
-        if (!defined($token)) {
+        $posted = defined($posted) ? $posted : '0';
+        $expires = defined($expires) ? $expires : '0';
+        if (!defined($token) || $token eq '') {
             $token = 'remembered';
         } else {
             # The token column stores the raw storage API token, so its hex

I'm also wondering whether it shouldn't be interesting to order the dump by arrival time so as to have a consistent output? select hex(hash), arrived, posted, expires, hex(token) from hist order by arrived;
It will be a little bit slower to answer though.
Or an -o parameter to specify the order if needed, without any sorting by default? -o arrived, -o posted, -o expires
Any thoughts about that?

@kev009

kev009 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@Julien-Elie your @@ fix and 0 fix sounds right. I'd lean toward the args/flags as better route (maybe -O to differentiate from ovsqlite-util -o?), because it will require a more expensive DB sort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working C: history Related to history P: low Low priority

Development

Successfully merging this pull request may close these issues.

2 participants