From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#54591: 29.0.50; sqlite-select returns blob result as multibyte string Date: Tue, 29 Mar 2022 18:38:59 +0300 Message-ID: <83o81o93ak.fsf@gnu.org> References: <83h77jaof6.fsf@gnu.org> <87lewsakng.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1637"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 54591@debbugs.gnu.org, casouri@gmail.com To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 29 17:40:49 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 1nZDxh-0000Jp-68 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 29 Mar 2022 17:40:49 +0200 Original-Received: from localhost ([::1]:37692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZDxf-0002Gz-Ng for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 29 Mar 2022 11:40:47 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZDww-0002Ff-0w for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2022 11:40:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39519) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nZDwv-0001kN-NI for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2022 11:40:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nZDwv-0007M4-K9 for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2022 11:40:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Mar 2022 15:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54591 X-GNU-PR-Package: emacs Original-Received: via spool by 54591-submit@debbugs.gnu.org id=B54591.164856834528202 (code B ref 54591); Tue, 29 Mar 2022 15:40:01 +0000 Original-Received: (at 54591) by debbugs.gnu.org; 29 Mar 2022 15:39:05 +0000 Original-Received: from localhost ([127.0.0.1]:33416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZDw1-0007Ko-0m for submit@debbugs.gnu.org; Tue, 29 Mar 2022 11:39:05 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:39796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZDw0-0007KM-31 for 54591@debbugs.gnu.org; Tue, 29 Mar 2022 11:39:04 -0400 Original-Received: from [2001:470:142:3::e] (port=39692 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZDvu-0001bO-Pc; Tue, 29 Mar 2022 11:38:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=gx1oEWegNHPmrfstAcNyvh+OTdGAJ9BSRS8TKF5rkmM=; b=WEeM+MCiTjIeqE7cHjbZ DaKHVcKCdSNWKsNqd0plUeaoD4L5HZp/T8cQAx5SOYKoHK0ZVu3A/7+FrQL4EY7NzWW0nRArdAXMt 0yqFbmL2MH3bneu9x0zPBqD7mEzgCd6vXEZ8ytaP9HrllT5RXWn/SApTuDpMuXSnpEMW6EYLDRkTH cgnhkj+ohKl6Q+PAWVPaJW0FWofOwwBlFdLrKtsr1o/nr+7Bdqvc+3azd+WhwAv27Qax4JnRr5gH0 8xnft2gi0yD2aJqZLBipGpCGG2+bKJmeHictnsNPLaDSQNFk+MoobWObJsCgNn+LPOjmcJAV5Molc 3OdRCbGf7dJkDw==; Original-Received: from [87.69.77.57] (port=2732 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZDvq-0000qa-NN; Tue, 29 Mar 2022 11:38:58 -0400 In-Reply-To: <87lewsakng.fsf@gnus.org> (message from Lars Ingebrigtsen on Tue, 29 Mar 2022 16:38:43 +0200) 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:229064 Archived-At: > From: Lars Ingebrigtsen > Cc: Yuan Fu , 54591@debbugs.gnu.org > Date: Tue, 29 Mar 2022 16:38:43 +0200 > > > If we want to support non-text data in a blob, then yes, I think you > > are right. > > I'm not sure there's any way to do that reliably. If we change blob > selections to not decode, then if you have > > create table if not exists test7 (col1 text, col2 blob) > > and then > > (format "insert into test7 values ('foĆ³', '%s')" binary) > > will have to encode the entire string in utf-8, meaning you get garbage > back when you select. (While today you get encoded binary back.) > > And if just say "well, don't do that, then; use prepared statements", > then > > "insert into test7 values (?, ?)" ["foo" binary] > > could work... if we knew the type of the columns here, but I can't find > any way to determine that on a statement that has been executed yet > (sqlite3_column_type/sqlite3_column_decltype only seems to work on > selects; perhaps I'm missing something -- anybody know?) Can we place the burden of knowing the type of the column on the caller? I mean, if they know it's a binary blob, they should tell us, and then we don't decode it? (Of course, if there's a way of knowing the type, we could DTRT automatically for each type.)