On 04/12/06, Mark Kirkwood <[EMAIL PROTECTED]> wrote:
Paul Mason wrote:
> Are you sure you installed a recent version of Ingres? I've not heard
> of dbaccess before and I don't think it's an ingres tool.
>
Ingres 2006 (int.lnx/103) built from source on Gentoo 2006.
Fair enough. It was the mention of "dbaccess" that confused me ;)
> As for your points sql terminal monitor "sql" will do what you want.
> It uses ; as an SQL command separator. It's line mode so "no terminal
> weirdness" and as of Ingres 2006 there's readline re-entry on Linux by
> using the "-history_recall" flag. If you're not on Linux, what I use
> all the time is "\e" to take your current input buffer into an editor.
> Just make sure that ING_EDIT is set to the path of your editor.
>
Sorry I should have rechecked (was away from the system with Ingres on
it, and typed from memory... that will teach me!). So lets see if I can
correct myself :-) :
In the version I have 'sql' uses '\go' and does not seem to provide
anything to change this (maybe int.lnx/104 changes to ';'?). With the
-history_recall option and using \e I get a (rather rudimentary I must
say, sorry) command line editing.
OK. There seems to be some confusion here. Possibly my fault as I may
not have explained myself very well. Everything that follows I'm able
to do on /103
With respect to 'dbaccess' - I should have said 'isql' (dunno how that
crept in...).
I think the original points still stand, with minor modifications,
essentially 'sql' is too basic and clunky, and 'isql' too fiddly...
I only used isql for years and years. That was in an environment where
we always used the same terminal emulator and TERM_INGRES was set up
the same. Then I came to work for CA and everyone used whatever they
liked and you couldn't rely on any two machines being set up similarly
(actually for good reason, when you're setting up testcases you want
to mirror customer environments as much as you can). I got sick of
setting it up all the time so I learnt to love command line sql.
Anyhow I think isql with the right termcap is fine, and sql is even
better *if* you know all the wrinkles.
1/ No terminal weirdness (ok sql has this).
2/ Command terminator ';' (preferably configurable) [1].
If by "command terminator" you mean "thing that causes the current SQL
to execute" then no that's not what ";" does. What ";" does is
separate SQL commands. \g (or \go) executes the current command
buffer. If you want to have more than one SQL command in your buffer
then you need to separate them with ";"s
So a typical Ingres SQL script might look like
SELECT * FROM table;
UPDATE table
SET column='value'
WHERE column='condition';
SELECT * FROM table;
\p\g
The \p prints the buffer so you can see what you're executing. There's
other \ commands that are documented in the SQL guide.
3/ Convenient (read: open src standand) command line editing via
libedit or readline.
The -history_recall implements readline. Then \e is something else. So
if you're using r3 or 2006 on Linux and you do
sql -history_recall mydb
then you can access previous entered lines with up and down arrows and
edit them accordingly. Similar to bash.
\e invokes an editor with the contents of the current buffer. Now if
you're editor hasn't been set up correctly (and ingres guesses, not
very well in the case of Linux, what your editor might be) it defaults
to ed - which is that rudimentary command line editor.
What you need to do is
ingsetenv ING_EDIT /path/to/favourite/editor
e.g. mine is
ingprenv ING_EDIT
ING_EDIT=/usr/bin/vim
(since vi is a shell alias for vim)
Others may prefer for e.g. emacs (they are of course insane but that's
another topic ;) and would set it accordingly. You can set ING_EDIT in
your local environment too if you prefer.
Cheers
Mark
[1] Now Paul says 2/ is already sorted - So I guess he is using
something like int.lnx/104 or 105.
Nope I can do all of the above with int.lnx/103
I would update if someone would post
the source code for these (103 is *still* the only source posted - hint).
That would be a good thing and is, I understand, coming.
HTH
--
Paul Mason
_______________________________________________
Users mailing list
[email protected]
http://lists.ingres.com/mailman/listinfo/users