From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Johannes =?UTF-8?Q?Gr=C3=B8dem?= Newsgroups: gmane.emacs.bugs Subject: bug#54591: 29.0.50; sqlite-select returns blob result as multibyte string Date: Fri, 01 Apr 2022 20:34:49 +0200 Message-ID: <878rso7iuu.fsf@flokut.localdomain> References: <83h77jaof6.fsf@gnu.org> <87lewsakng.fsf@gnus.org> <83o81o93ak.fsf@gnu.org> <87a6d672xr.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23601"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) To: 54591@debbugs.gnu.org Cancel-Lock: sha1:4jEeisvzLem5ZXSzzdEMN2DU7AI= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 01 21:46:23 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1naNDx-0005tk-Sz for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Apr 2022 21:46:21 +0200 Original-Received: from localhost ([::1]:57392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1naNDw-0002Nc-9S for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Apr 2022 15:46:20 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naNDe-0002NS-97 for bug-gnu-emacs@gnu.org; Fri, 01 Apr 2022 15:46:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49602) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1naNDe-0006XJ-0Y for bug-gnu-emacs@gnu.org; Fri, 01 Apr 2022 15:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1naNDd-0006Be-UN for bug-gnu-emacs@gnu.org; Fri, 01 Apr 2022 15:46:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Johannes =?UTF-8?Q?Gr=C3=B8dem?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Apr 2022 19:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54591 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.164884231923729 (code B ref -1); Fri, 01 Apr 2022 19:46:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Apr 2022 19:45:19 +0000 Original-Received: from localhost ([127.0.0.1]:43499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naNCx-0006Af-F6 for submit@debbugs.gnu.org; Fri, 01 Apr 2022 15:45:19 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:58350) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naMa2-00056s-VL for submit@debbugs.gnu.org; Fri, 01 Apr 2022 15:05:07 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:35658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naMa2-0004Lw-Ou for bug-gnu-emacs@gnu.org; Fri, 01 Apr 2022 15:05:06 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:56018) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naMa1-0000bF-03 for bug-gnu-emacs@gnu.org; Fri, 01 Apr 2022 15:05:06 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1naMZy-00050B-CP for bug-gnu-emacs@gnu.org; Fri, 01 Apr 2022 21:05:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=geb-bug-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 01 Apr 2022 15:45:18 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:229240 Archived-At: Lars Ingebrigtsen writes: >> (Of course, if there's a way of knowing the type, we could DTRT >> automatically for each type.) > > Yes, I'm hoping somebody else could have a look at the sqlite > documentation and tell me I'm missing some obvious way to get that > information. :-) I might be misunderstanding the issue, but SQLite column types are more like documentation than actual rules to be enforced, unless STRICT tables are enabled. https://www.sqlite.org/datatype3.html In Python's SQLite3 API, ordinary strings are inserted as SQLite TEXTs and bytestrings are inserted as SQLite BLOBs, and returned as the same when you query. It's using a function similar to row_to_value for this, except that it for some reason doesn't switch on SQLITE_BLOB, it just calls sqlite3_column_blob and tests if it returns NULL or not and then it does a switch on the remaining types. Couldn't the Emacs interface just use vectors of byte values for BLOBs both ways? Or is there another data type that makes more sense? By the way, if you want to insert BLOBs in the query itself you can do it like this, but I guess this doesn't need Emacs support, except maybe a helper function for the conversion: INSERT INTO foo VALUES (X'deadcafe');