SQL Mode Version 0.922 (beta) Release Notes
A lot of code was re-written with an eye on performance for this
release of SQL Mode. Some new features were added as well, and of
course a large number of bugs were fixed. Additionally, there is
more support for FSF Emacs, but it's not nearly 100% yet.
What's new in SQL Mode:
o new evaluation methods
The evaluation code has been re-written with an emphasis on
speed and flexibility. You can now specify if you want your
evaluations to be done in the foreground (synchronously) or in
the background (asynchronously). The value of the variable
`sql-evaluation-method' controls this. You can set this
variable from the menubar by selecting the item
`Options-->Evaluation Method'. The value of this variable
will affect the keybindings M-i and C-c C-e, as well as the
"GO" button from the toolbar. If you want to do most of your
evaluations in the foreground, but occasionally run a
background query, you can invoke the command
`sql-evaluate-buffer-asynchronous' directly (bound to the M-e
key by default).
o stay logged into the dataserver
By setting the value of the variable `sql-stay-logged-in' to a
non-nil value (or by selecting the menu item
`Options-->Dataserver Connection-->Stay Logged In') you can
keep an open connection to the dataserver to do your queries.
This increases the performance of almost all aspects of SQL
Mode dramatically, as you remove the overhead of invoking a
new isql process, and logging in each time you invoke a query.
o associated evaluation buffers for sql-mode buffers
If you edit a file in sql-mode, you can now send contents of
that file to a sql-batch-mode buffer for evaluation. You can
specify the batch mode buffer to perform the evaluations by
selecting "SQL-->Set Evaluation Buffer" from the menu bar.
Once an evaluation buffer has been set, you can send it the
contents of the whole buffer with `sql-mode-evaluate-buffer'
(bound to M-i), `sql-mode-evaluate-region', and
`sql-mode-evaluate-statement'. The function
`sql-mode-evaluate-statement' will operate on the current
block of SQL code, in between the proceeding "go" and up to and
including the next "go".
o history local to batch buffer
Now that history is local to the batch buffer, you should
never another unlinked history again. M-p and M-n should
always keep the batch buffer and the results buffer in sync.
If you have a need for going back through the batch buffer's
history without disturbing the results buffer, give the
commands a prefix argument: C-u M-p and C-u M-n.
o history saving and loading
Your history can now be saved between emacs sessions. Just
set the value of the variables `sql-save-history-on-exit' and
`sql-always-load-history' to t (you can do this from the Options
menu as well). The history information is saved to files in the
~/.sql-history-dir directory.
o buffer information for sql-mode buffers
C-c h i will now display useful information in sql-mode
buffers (as well as sql-batch-mode and sql-results-mode
buffers) including the name of the associated evaluation
buffer, if any.
o menu aliases for associations
The variable sql-association-alist now accepts a third
element, the menu alias to use for this association. Now you
can specify the string to appear in the popup and top-level
menus for associations. An example:
(setq sql-association-alist
'(("-" ("HEADING A" "" ""))
("-" ("----" "" ""))
("A1" ("SERVER1" "USER1" "PASS1" "DB1") "ALIAS1")
("A2" ("SERVER2" "USER2" "PASS2" "DB2") "ALIAS2")
("-" ("----" "" ""))
("-" ("HEADING B") "" "")
("-" ("----" "" ""))
("B3" ("SERVER3" "USER3" "PASS3" "DB3") "ALIAS3")
("B4" ("SERVER4" "USER4" "PASS4" "DB4") "ALIAS4")))
In this example, the strings in the menubar and popup menus
would be ALIAS1, ALIAS2, etc.
o buffer-modified-p now supported
The two characters towards the left of the modeline that
indicated whether a buffer has been modified or not are now
functional in sql-batch-mode and sql-results-mode buffers.
o other performance enhancements
All of the functions that queried the dataserver for
completion were written in a very sub-optimal way. That code
has been re-written and sped up by a factor of at least 2.
The functions sql-paste, sql-insert-row, and sql-delete-row
were extremely slow for wide rows. This has been corrected.
o sql-top-ten-help
Top Ten toolbar buttons will now have informative help strings
displayed in the echo area. You need to re-save your Top Ten
items and re-start XEmacs for the change to take effect.
o fake BCP of multiple rows
You can now do a bcp out of a single row or multiple rows from
the results buffer. Highlight the row(s) you wish to copy out
of the the results buffer and type M-x sql-fake-bcp-out (or
simply select it from the menu bar).
What's changed:
o sql-risky-searches now defaults to t
This variable determines the strictness of searching for
where clauses when performing updates. If a where statement
is commented out, for instance, it should not "count".
Similarly if an update statement is commented out, there should
be no need to search for a where clause.
In earlier versions of XEmacs there was a bug in the function
buffer-syntactic-context. I have not been able to reliably
reproduce this bug in current versions of XEmacs, and setting
the value of this variable to t will suppress the hacks that
prevent the bug from rearing it's ugly head. If set to a
non-nil value, it is possible that sql code that should be
warned against will not. This becomes a large bug as users
get more comfortable with their updates, relying on the
warnings.") In earlier versions of XEmacs, there was a bug
that caused
o enhanced completion
You can now complete based on column values. If you type
"select * from foo where bar = [TAB]" it will complete to
all of the values for bar in foo. Because there are potentially
a large number of possibilities for values, only the first 1000
values are returned. This is, of course, configurable.
Completion is available for users. If you type "sp_helpuser [TAB]"
SQL Mode will offer completion based on the users in the database.
Completion is available for operators.
Completion works after "sp_helpdb", completing to the list of
databases.
Table alias completion is now supported for column names. For
instance, if you type:
select * from foo a, bar b where b.[TAB]
It will complete to all of the columns in table "bar".
o sql-magic-yank-under-point
This function is now bound to button2 in sql-results-mode
buffers, and it is much smarter. Quotes go around values that
need it (if the table has been completed and is in the cache),
and column names and operators are inserted as necessary.
o sql-get-rows-affected doesn't modify buffer contents
When you execute an update statement, the "begin tran" and
"rollback tran" statements aren't inserted in the buffer, so
you no longer see the contents of the buffer flicker.
o process status in modeline
If you selected the "stay logged into dataserver" option, the
status of the child process is displayed in the modeline.
o history item in modeline
Now that histories can be saved between emacs sessions, the
number of saved history elements becomes more important. The
current and total number of history items are now displayed
in the modeline.
Bug Fixes:
o removed NULL from sql-keyword-regexp
It was causing some completion mishaps.
o results buffers font-lock bug fixed
If you had a single or double quote in a data field, it would
cause the rest of the text in sql-results-mode buffers to be
highlighted in the font-lock-string-face. This has been
corrected.