unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Andrew Hyatt <ahyatt@gmail.com>, 59346@debbugs.gnu.org
Subject: bug#59346: Adding sqlite-backup
Date: Sat, 19 Nov 2022 08:17:21 +0300	[thread overview]
Message-ID: <Y3hm4XjymCpyvDiY@protected.localdomain> (raw)
In-Reply-To: <83h6ywbgo5.fsf@gnu.org>

* Eli Zaretskii <eliz@gnu.org> [2022-11-18 15:18]:
> > From: Andrew Hyatt <ahyatt@gmail.com>
> > Date: Fri, 18 Nov 2022 09:05:58 -0300
> > Cc: 59346@debbugs.gnu.org
> > 
> >  Thanks, but I'm not sure Emacs should support DB administration
> >  functions of sqlite.  Aren't there utilities out there which can be
> >  used for this?  Why should we have this built-in in Emacs? why not
> >  simply use shell-command or somesuch to invoke the necessary external
> >  program?
> > 
> > Good questions. Let me respond to your two questions: why does emacs need to be involved in backups,
> > and why can't it control backups some other way?
> > 
> > Emacs already has a file backup facility, but if emacs is primarily working with data in sqlite, there is no
> > mechanism for backups, which seems scary to me.  I'd like modules that rely on sqlite for data to be able to
> > back up their data, because the user would like to have some security, knowing if something goes wrong
> > they can always restore a recent backup.
> 
> A database is not like a normal file, and so the fact that Emacs has
> backups doesn't seem to be a reason good enough to extend the backups
> to DB operations.

In this case SQLite database is normal file. It is not text. But it is
definitely a file.

It requires usage of internal functions:

SQLite Backup API:
https://www.sqlite.org/backup.html

> We don't bother with this when we send email or do other operations.
> We also have auto-save and file-locks for normal file, but not for
> DBs.  And a DB is not a file, it is a (large) collection of tables
> and records, and Emacs deals with at most a single table at a time,
> AFAIU.

You mean it is not text file.

> More generally, DB administration is outside of the Emacs scope, and
> how to do that properly is outside our expertise.  There's more to it
> than just backing up the DB.

When there are sqlite functions included then so much of database
administration automatically becomes available to Emacs. Statement is
contradictory to the inclusion of SQLite.

> This SO article:
> 
>   https://stackoverflow.com/questions/25675314/how-to-backup-sqlite-database
> 
> (which is the first hit I get if I "how to backup sqlite database"
> into the browser search box) says that you can backup the DB by using
> the sqlite3 executable.  I think it is reasonable to expect users who
> want to backup their DB to have this executable and use it for that
> purpose (and other purposes, as they need).  I do have this executable
> here, FWIW.
> 
> So I think these needs should be fulfilled "by other means", not by
> Emacs Lisp programs.

That patch uses SQLite internals, without those, Emacs Lisp can't
properly backup the database. Without that patch, Emacs which does
support now SQLite would ask users to default to using external
program, like:

`sqlite3 currentDB.sqlite ".backup backuDB.sqlite"'

but how sure are you that you will have that external program
`sqlite3' in existence? 

When SQLite is already included in Emacs, it should not expect then
that external SQLite related software is available on the system.

It is logical that Emacs with SQLite included should have proper way
of doing backup without relying on external tools.

--
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/





  parent reply	other threads:[~2022-11-19  5:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-18  2:40 bug#59346: Adding sqlite-backup Andrew Hyatt
2022-11-18  7:46 ` Eli Zaretskii
2022-11-18 12:05   ` Andrew Hyatt
2022-11-18 12:17     ` Eli Zaretskii
2022-11-19  2:05       ` Andrew Hyatt
2022-11-19  5:29         ` Jean Louis
2022-11-19  5:17       ` Jean Louis [this message]
2022-11-19  7:52         ` Eli Zaretskii
2022-11-19 13:36           ` Andrew Hyatt
2022-11-19 13:51             ` Eli Zaretskii
2022-11-19  8:07       ` Stefan Kangas
2022-11-19  5:03   ` Jean Louis
2022-11-19  4:52 ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y3hm4XjymCpyvDiY@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=59346@debbugs.gnu.org \
    --cc=ahyatt@gmail.com \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).