There are some new features. Actually, some pretty cool ones.
Sqsh should automatically detect how to compile against both Sybase OpenClient (11.x, 12.x and 15.x) and FreeTDS now. Also, libsybtcl will now automatically be chosen over libtcl if available (this is usually a problem on Linux environments).
One of the biggest enhancements is the addition of rather rudamentary flow-of-control extensions to the sqsh "language" (I guess you can call it that now).
PLEASE PLEASE PLEASE note. Even in my own opinion, I consider the way these commands to be implemented to be a hack and a bit crufty (they seem to work though). I would strongly discourage using them for anything more than interactive use or for little helper functions (i.e. don't go building a CRM system with them).
| \if, \else, \elif, \fi | Perform conditional execution of portions of SQL or
other sqsh commands. The syntax is pretty close to
that of Bourne shell:
\if [ $x -lt 10 ]
\echo hello
\elif [ $x -lt 15 ]
\echo hi
\else
\echo howdy
\fi
|
| \while, \done, \break | Provides a basic looping conditional:
\while [ $x -lt 10 ]
\echo $x
\set x=`expr $x + 1`
\done
|
| \for | Performs basic iteration over a list:
\for i in 1 2 3 4 5 6
\echo $i
\done
|
| \do | Allows the execution of a sqsh script
(and additional SQL statements) once per row returns from
a SQL query; like a redudamentary cursor. The new variable
syntax #[0-9] may be used to refer to the contents
of columns in the result set:
SELECT name FROM sysdatabases
\do
USE #1
go
CHECKPOINT
go
\done
Also note that \do allows flags -U, -S, and -P for
execution of statements ona different server or as a
different user.
|
| \func, \return, \call | Creates a sqsh function for later
execution. The new variable syntax ${[0-9]} now
refer to the parameters to this function when it is called.
\func stats
SET STATISTICS IO ${1}
SET STATISTICS TIME ${1}
go
\done
\call stats on
Note that by passing -x to the \func definition,
the function will be exported to a full sqsh command and can
be called directly without calling \call.
|
Make sure that you read the sqsh man page carefully and understand the relationship between SQL buffers and the commands before trying any heavy coding.
The following new features have been added:
${prefix}/etc/sqshrc:$HOME/.sqshrc
and a default global sqshrc file will be installed.
The following bugs have been corrected since 1.7: