ShellSQL – SQL for shell scripts

ShellSQL – SQL for shell scripts
ShellSQL is a suite of programs designed to enable LINUX/UNIX shell scripts to connect to SQL engines and execute SQL queries and commands in a simple way enabling intergration with the rest of the script. For example, it can do things like..

#/bin/shHANDLE=`shpostgres dbname=mydb`

shsql $HANDLE "begin"

for ARG in $

do

shsql $HANDLE "insert into mytable fld1, fld2" \

"values nextvalmyseq, $ARG"

done

shsql $HANDLE "commit"

if [ $# -gt 0 ]

then

ROWS=`shsql $HANDLE "select count from mytable"`

echo "No of rows now in table is" $ROWS

fi

shsqlend $HANDLE

For details on how it hangs together have a look at the overview.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s