From: Eduardo Ochs <eduardoochs@gmail.com>
To: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Bypassing the prompts in M-x sql-sqlite
Date: Sat, 29 Oct 2022 10:38:00 -0300 [thread overview]
Message-ID: <CADs++6irro_v1hu-KXrr9GiGatHLiChLzNQpwmQzWVNC_b-6=w@mail.gmail.com> (raw)
Hi all,
this is - or should be - a very basic question about sql.el...
Let me start by some context.
1. Some context
===============
A person who has never used SQL in her life, but who knows this,
http://angg.twu.net/eepitch.html
can have a very quick introduction to how to use sqlite - in a very
primitive way - by just running this, by typing <f8> on each line:
• (eepitch-shell)
• (eepitch-kill)
• (eepitch-shell)
rm -v /tmp/music.sqlitedb
sqlite3 /tmp/music.sqlitedb
create table albums (
artist text,
album text
);
.dump albums
insert into albums (artist, album) values("Hugo Largo", "Drum");
insert into albums (artist, album) values("Medicine","Her Highness");
insert into albums (artist, album) values("Pink Industry","Retrospective");
insert into albums (artist, album) values("David Bowie", "Low");
.dump albums
.quit
The next step is to show her how to use sql.el. This
M-x sql-sqlite RET /tmp/music.sqlitedb RET
creates a buffer called "*SQL: SQLite*" in sql-interactive-mode mode.
The comments at the top of sql.el say:
This file provides a sql-mode and a sql-interactive-mode. The
original goals were two simple modes providing syntactic
highlighting. The interactive mode had to provide a command-line
history; the other mode had to provide "send region/buffer to SQL
interpreter" functions. "simple" in this context means easy to
use, easy to maintain and little or no bells and whistles. This
has changed somewhat as experience with the mode has accumulated.
It should be possible to have both methods of sending commands to
"*SQL: SQLite*" available at the same time - eepitch-line and
sql-send-{paragraph,region}...
2. The question
===============
How do I write a sexp that does the same as
M-x sql-sqlite RET /tmp/music.sqlitedb RET
when the SQL buffer doesn't exist, and the same as M-x sql-sqlite RET
when the SQL buffer already exists? I am probably misreading the code
in sql.el and, ahem, mislooking some important things, because all my
attempts to write code that bypasses the prompts have failed...
Thanks in advance! =)
Eduardo Ochs
http://angg.twu.net/eepitch.html#other-targets
reply other threads:[~2022-10-29 13:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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='CADs++6irro_v1hu-KXrr9GiGatHLiChLzNQpwmQzWVNC_b-6=w@mail.gmail.com' \
--to=eduardoochs@gmail.com \
--cc=help-gnu-emacs@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.
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).