Subject: bug#54591: 29.0.50; sqlite-select returns blob result as multibyte string

From: Rudolf Schlatte <[email-masked]>
Date: Sun, 03 Apr 2022 12:42:15 +0200

Lars Ingebrigtsen <[email-masked]> writes:

> Lars Ingebrigtsen <[email-masked]> writes:
>
>> No, I posted a later post which has the solution I'm going to implement.
>
> (Which is basically a tweak on one of the solutions I proposed in my
> first message in this thread (with the comment "yuck").  I'm still
> waiting for somebody to correct me that I'm reading the sqlite
> documentation wrong and that you can actually find out the column type
> you're inserting into, because it seems rather absurd that that
> functionality doesn't exist.)

Does the transcript below do what you're looking for?

$ sqlite3
SQLite version 3.37.0 2021-12-09 01:34:53
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> create table foo(x text not null, y blob not null);
sqlite> select * from sqlite_master;
table|foo|foo|2|CREATE TABLE foo(x text not null, y blob not null)
sqlite> .schema sqlite_master
CREATE TABLE sqlite_master (
  type text,
  name text,
  tbl_name text,
  rootpage integer,
  sql text
);
sqlite>