Some output modes of shell.c already automatically hex print BLOB's:

<code>
static void output_hex_blob(FILE *out, const void *pBlob, int nBlob){
  int i;
  char *zBlob = (char *)pBlob;
  raw_printf(out,"X'");
  for(i=0; i<nBlob; i++){ raw_printf(out,"%02x",zBlob[i]&0xff); }
  raw_printf(out,"'");
}
</code>

That function is called within the output loop switch statement:

<code>
   case MODE_Quote:
    case MODE_Insert: {
/*...bunch of code omitted*/
          output_hex_blob(p->out, pBlob, nBlob);
</code>

I'm not a user of BLOB's.  Maybe somebody else knows the use case for the
raw bytes in the other modes?   If there is no use case whatsoever, maybe
this is a bug report.




On Tue, May 9, 2017 at 9:24 AM, Jens Alfke <j...@mooseyard.com> wrote:

>
> > On May 9, 2017, at 4:21 AM, Hick Gunter <h...@scigames.at> wrote:
> >
> > You may store any sequence of bytes in a BLOB, but please do not expect
> a data storage layer library to handle opaque objects.
>
> This sounds like a typo? I definitely _do_ expect a data storage library
> to handle opaque/binary objects.
>
> > If you do need to see inside a blob, use the HEX() function to convert
> it to a readable form.
>
> It has always annoyed me that the CLI just dumps blobs directly to stdout.
> At best it’s unreadable garbage, and at worst it outputs escape sequences
> that mess up the terminal window’s settings. My schema stores a lot of
> binary data, and if I’m in the CLI and forget a “hex(…)” wrapper in a
> SELECT statement, sometimes I have to close the window to recover from
> purple-on-blue text :-p
>
> IMO, blobs in the output should be either partially or fully escaped. If
> there is somehow a reason for letting the CLI output raw binary, then at
> least add a setting for how to output blobs, defaulting to
> partially-escaped.
>
> —Jens
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to