* Tabs and ends of lines in sql mode
@ 2006-02-08 0:23 jiri.pejchal
2006-02-08 12:24 ` Thien-Thi Nguyen
2006-02-09 13:18 ` Tim X
0 siblings, 2 replies; 5+ messages in thread
From: jiri.pejchal @ 2006-02-08 0:23 UTC (permalink / raw)
I'm using the latest sql mode with emacs from cvs.
The function sql-send-parafraph sends current paragraph
to the SQL process. However it sends the paragraph with
tabs and ends of lines. In mysql or psql tabs are bound
to completion and so the completion is printed. Moreover
ends of lines cause secondary prompts to be printed.
So for:
create table stock (
id int4,
avail int4,
ordered int4,
valid bool,
description text
);
six secondary prompts and five times the completions (several lines)
are printed, that is very inconvenient.
Is there a way for sql-send-paragraph to not sends the tabs and ends
of lines?
--
Jiri Pejchal
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Tabs and ends of lines in sql mode
2006-02-08 0:23 Tabs and ends of lines in sql mode jiri.pejchal
@ 2006-02-08 12:24 ` Thien-Thi Nguyen
2006-02-09 13:18 ` Tim X
1 sibling, 0 replies; 5+ messages in thread
From: Thien-Thi Nguyen @ 2006-02-08 12:24 UTC (permalink / raw)
jiri.pejchal@gmail.com writes:
> Is there a way for sql-send-paragraph to not sends the tabs and ends
> of lines?
it has to send at least one newline (at the end of the paragraph).
you probably meant to say internal tabs and newlines. the best
solution would be to disable the secondary prompting and
completion in the subproc, but here is a rewrite of
`sql-send-paragraph' as a workaround:
(defun sql-send-paragraph ()
"Send the current paragraph to the SQL process."
(interactive)
(let ((raw (buffer-substring-no-properties
(save-excursion
(backward-paragraph)
(point))
(save-excursion
(forward-paragraph)
(point)))))
;; subdue secondary-prompting and completion over-helpfulness
(while (string-match "\n\t*" raw)
(setq raw (concat (substring raw 0 (match-beginning 0))
" "
(substring raw (match-end 0)))))
(sql-send-string raw)))
i think this is ugly, however. mulling over comint.el now...
thi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Tabs and ends of lines in sql mode
2006-02-08 0:23 Tabs and ends of lines in sql mode jiri.pejchal
2006-02-08 12:24 ` Thien-Thi Nguyen
@ 2006-02-09 13:18 ` Tim X
2006-02-10 0:21 ` Thien-Thi Nguyen
1 sibling, 1 reply; 5+ messages in thread
From: Tim X @ 2006-02-09 13:18 UTC (permalink / raw)
jiri.pejchal@gmail.com writes:
> I'm using the latest sql mode with emacs from cvs.
>
> The function sql-send-parafraph sends current paragraph
> to the SQL process. However it sends the paragraph with
> tabs and ends of lines. In mysql or psql tabs are bound
> to completion and so the completion is printed. Moreover
> ends of lines cause secondary prompts to be printed.
>
> So for:
> create table stock (
> id int4,
> avail int4,
> ordered int4,
> valid bool,
> description text
> );
>
> six secondary prompts and five times the completions (several lines)
> are printed, that is very inconvenient.
>
> Is there a way for sql-send-paragraph to not sends the tabs and ends
> of lines?
>
There are some add-ons I've used int he past which can help with
this. However, I don't seem to have them anymore. I think originally,
I may have found them at the emacs wiki site http://www.emacswiki.org.
One way to prevent the tab problem would be to reconfigure emacs so
that it uses spaces rather than tabs when you insert a tab. From
memory, this is covered in the on-line FAQ.
Tim
P.S. I gather psql is postgres' procedural SQL language. What is it
like to work with compared to oracle plsql or that MS SQL Server one
(whats it called again?).
Just curious
--
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you
really need to send mail, you should be able to work it out!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Tabs and ends of lines in sql mode
2006-02-09 13:18 ` Tim X
@ 2006-02-10 0:21 ` Thien-Thi Nguyen
0 siblings, 0 replies; 5+ messages in thread
From: Thien-Thi Nguyen @ 2006-02-10 0:21 UTC (permalink / raw)
Tim X <timx@spamto.devnul.com> writes:
> P.S. I gather psql is postgres' procedural SQL language.
psql is an interactive (shell) that can process SQL and
do other meta stuff (list tables, describe schemas, etc).
to veer this thread even more tangentially, there is a nifty (IMHO)
emacs front end to postgresql via guile called gxrepl in Guile-PG:
http://www.glug.org/people/ttn/software/guile-pg/
a sample gxrepl session is at:
http://www.glug.org/docbits/qcons-notes.txt
gxrepl is what i use to type less SQL (and more parens :-).
thi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Tabs and ends of lines in sql mode
@ 2006-04-22 17:31 Jiri Pejchal
0 siblings, 0 replies; 5+ messages in thread
From: Jiri Pejchal @ 2006-04-22 17:31 UTC (permalink / raw)
The function sql-send-paragraph in sql.el sends current paragraph to the
SQL process. However it sends the paragraph with leading tabs and ends
of lines. In database front-ends like mysql or psql tabs are bound to
completion and so the completion is printed. Moreover ends of lines
cause secondary prompts to be printed.
So if I send:
create table stock (
id int4,
avail int4,
ordered int4,
valid bool,
description text
);
six secondary prompts and five times the completions (several lines) are
printed, that is very inconvenient.
Could sql mode not send the internal tabs and ends of lines?
Jiri Pejchal
Sending the previous example produces following output:
test=> test(>
ABORT COMMIT END LISTEN RELEASE SHOW
ALTER COPY EXECUTE LOAD RESET START
ANALYZE CREATE EXPLAIN LOCK REVOKE TRUNCATE
BEGIN DEALLOCATE FETCH MOVE ROLLBACK UNLISTEN
CLOSE DECLARE GRANT NOTIFY SAVEPOINT UPDATE
CLUSTER DELETE FROM CHECKPOINT PREPARE SELECT VACUUM
COMMENT DROP INSERT REINDEX SET
test(>
ABORT COMMIT END LISTEN RELEASE SHOW
ALTER COPY EXECUTE LOAD RESET START
ANALYZE CREATE EXPLAIN LOCK REVOKE TRUNCATE
BEGIN DEALLOCATE FETCH MOVE ROLLBACK UNLISTEN
CLOSE DECLARE GRANT NOTIFY SAVEPOINT UPDATE
CLUSTER DELETE FROM CHECKPOINT PREPARE SELECT VACUUM
COMMENT DROP INSERT REINDEX SET
test(>
ABORT COMMIT END LISTEN RELEASE SHOW
ALTER COPY EXECUTE LOAD RESET START
ANALYZE CREATE EXPLAIN LOCK REVOKE TRUNCATE
BEGIN DEALLOCATE FETCH MOVE ROLLBACK UNLISTEN
CLOSE DECLARE GRANT NOTIFY SAVEPOINT UPDATE
CLUSTER DELETE FROM CHECKPOINT PREPARE SELECT VACUUM
COMMENT DROP INSERT REINDEX SET
test(>
ABORT COMMIT END LISTEN RELEASE SHOW
ALTER COPY EXECUTE LOAD RESET START
ANALYZE CREATE EXPLAIN LOCK REVOKE TRUNCATE
BEGIN DEALLOCATE FETCH MOVE ROLLBACK UNLISTEN
CLOSE DECLARE GRANT NOTIFY SAVEPOINT UPDATE
CLUSTER DELETE FROM CHECKPOINT PREPARE SELECT VACUUM
COMMENT DROP INSERT REINDEX SET
test(>
ABORT COMMIT END LISTEN RELEASE SHOW
ALTER COPY EXECUTE LOAD RESET START
ANALYZE CREATE EXPLAIN LOCK REVOKE TRUNCATE
BEGIN DEALLOCATE FETCH MOVE ROLLBACK UNLISTEN
CLOSE DECLARE GRANT NOTIFY SAVEPOINT UPDATE
CLUSTER DELETE FROM CHECKPOINT PREPARE SELECT VACUUM
COMMENT DROP INSERT REINDEX SET
test(> CREATE TABLE
test=>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-04-22 17:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-08 0:23 Tabs and ends of lines in sql mode jiri.pejchal
2006-02-08 12:24 ` Thien-Thi Nguyen
2006-02-09 13:18 ` Tim X
2006-02-10 0:21 ` Thien-Thi Nguyen
-- strict thread matches above, loose matches on Subject: below --
2006-04-22 17:31 Jiri Pejchal
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.