GNU bug report logs - #65999
[PATCH] Remove column quoting and close sqlite db on buffer kill

Previous Next

Package: emacs;

Reported by: Thomas Hilke <t.hilke <at> rollomatic.ch>

Date: Fri, 15 Sep 2023 13:05:02 UTC

Severity: normal

Tags: patch

Merged with 65998

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 65999 in the body.
You can then email your comments to 65999 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#65999; Package emacs. (Fri, 15 Sep 2023 13:05:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thomas Hilke <t.hilke <at> rollomatic.ch>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 15 Sep 2023 13:05:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thomas Hilke <t.hilke <at> rollomatic.ch>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: [PATCH] Remove column quoting and close sqlite db on buffer kill
Date: Fri, 15 Sep 2023 11:19:28 +0000
[Message part 1 (text/plain, inline)]
Tags: patch

Hi everyone,

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 [1], if I
  understand correctly, the quoted column name 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 is the modifications that makes it work for me. I didn't have
the opportunity to test it under linux or another environment.

I did not want to touch the other parts that were already working, but
note that sqlite support a collection of pragma statements [2] that can
be used to inspect the schema of the database in a more structured why
than parsing the content of the sqlite_master table.

I hope it helps, and thanks for all the great work!

In GNU Emacs 30.0.50 (build 2, x86_64-w64-mingw32)
Repository revision: cb8f39ad6a5129fe18f2ebb0a1619f6949cd3d32
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 10.0.22621
System Description: Microsoft Windows 10 Pro (v10.0.2009.22621.2134)

Configured using:
 'configure --prefix=/d/a/emacs-build/emacs-build/pkg/master-x86_64
 'CFLAGS=-Ofast -fno-finite-math-only -fomit-frame-pointer'
 --with-native-compilation --with-zlib --with-xpm --with-xml2
 --with-tree-sitter --without-tiff --with-rsvg --with-png --with-lcms2
 --with-json --with-jpeg --with-harfbuzz --with-gnutls --with-gif
 --without-cairo --disable-build-details --without-dbus
 --with-compress-install --with-small-ja-dic'

Footnotes:
[1] https://www.sqlite.org/lang_keywords.html
[2] https://www.sqlite.org/pragma.html

Thomas Hilke
[0001-Remove-column-quoting-and-close-sqlite-db-on-buffer-.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65999; Package emacs. (Fri, 15 Sep 2023 15:46:01 GMT) Full text and rfc822 format available.

Message #8 received at 65999 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Thomas Hilke <t.hilke <at> rollomatic.ch>
Cc: 65999 <at> debbugs.gnu.org
Subject: Re: bug#65999: [PATCH] Remove column quoting and close sqlite db on
 buffer kill
Date: Fri, 15 Sep 2023 18:45:11 +0300
merge 65999 65998
thanks

> Date: Fri, 15 Sep 2023 11:19:28 +0000
> From:  Thomas Hilke via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> 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:

This is an exact duplicate of bug#65998 which you filed a short time
ago, so I'm merging them.




Merged 65998 65999. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 15 Sep 2023 15:46:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 15 Oct 2023 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 208 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.