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#65998: Sqlite-mode issue deleting records and closing database Date: Sat, 16 Sep 2023 13:24:20 +0300 Message-ID: <83h6nuiffv.fsf@gnu.org> References: <125a2ffc4cc34a3eb03ecebb4dfc2f9f@rollomatic.ch> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17257"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65998@debbugs.gnu.org To: Thomas Hilke , Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 16 12:25:16 2023 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 1qhSUF-0004Gt-Re for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Sep 2023 12:25:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhSTz-0008M5-Dl; Sat, 16 Sep 2023 06:24:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhSTv-0008Kp-Rx for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 06:24:56 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhSTv-0001VA-H3 for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 06:24:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qhSU2-00041S-Eq for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 06:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Sep 2023 10:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65998 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 65998-submit@debbugs.gnu.org id=B65998.169485988415412 (code B ref 65998); Sat, 16 Sep 2023 10:25:02 +0000 Original-Received: (at 65998) by debbugs.gnu.org; 16 Sep 2023 10:24:44 +0000 Original-Received: from localhost ([127.0.0.1]:45464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhSTk-00040V-4F for submit@debbugs.gnu.org; Sat, 16 Sep 2023 06:24:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59172) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhSTg-00040C-95 for 65998@debbugs.gnu.org; Sat, 16 Sep 2023 06:24:42 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhSTT-0001SA-8x; Sat, 16 Sep 2023 06:24:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=A3eAybH6OFvIEV2cn9geWdG3YmQbTTpeRTeHRKhN3oE=; b=GvNfcP4ohYrl h1oyOe/tmXbwq+dGoWpLhlNFjlw0wHDjEAWuMt1LasCEZSOsMYFSMEi8Hm3WXRKMvWmOaleylOqvL RdMhOpkuasM4uYRtdXr3IDiDR5aEwUFc+elUz+cV1pTvN9KfBbTD/f49cuavmflMisAWOquX9uubc Bpcjl+y1yjWyhNc94x5TJQ8MJt2gIYDfpIVMcCr16xbdmriRKAAOuM3ZN9gAJhFVFQgkhS/FMLLA7 yiMKH7zYBg5BlwMTra5LWlh8cFAE2mRjU1YUvKRtWE7C2iM6xcZOzgpCObuPi/PFkr4aT/vjamk8p lMqOimmuNw8dQ6feDo/w4Q==; In-Reply-To: <125a2ffc4cc34a3eb03ecebb4dfc2f9f@rollomatic.ch> (bug-gnu-emacs@gnu.org) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270603 Archived-At: > Date: Fri, 15 Sep 2023 09:02:49 +0000 > From: Thomas Hilke via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > I had the opportunity of using sqlite-mode recently, which is really > handy for quickly inspecting the content of a database. However, I > noticed two issues when using it from Windows: > > - The sql query built by sqlite-mode-delete is syntactically correct, > but misinterpreted by sqlite, and eventually do nothing. The query > is of the form "REMOVE FROM table_name WHERE rowid = ? and > 'column_name_1' = ? and 'column_name_2' = ? and ..." From > https://www.sqlite.org/lang_keywords.html, if I understand > correctly, the quoted column names in the WHERE clause are > interpreted as strings from sqlite, and as a result not a single row > is ever matched and deleted. > > - The connection to the sqlite database (file) is never closed, even > when the buffer is killed. As sqlite--db is a local variable, > it's not even possible to close the connection by hand once the > buffer is killed. That means that once a database file is opened > with sqlite-mode-open-file, the file cannot be deleted unless > emacs is closed (on Windows). > > Attached are the modifications that makes it work for me. I didn't have > the opportunity to test it under linux or another environment. Thanks. I installed on the emacs-29 branch the first part of your patch, which closes the DB when the buffer is killed. As for the second part, I'd prefer that Lars or someone who knows SQL reviewed it first, as I find it strange that Lars would code something so basic which doesn't work at all. Could someone who knows SQL please review and chime in?