(SAT) Demo Application - main |
Source Code |
#!/usr/bin/ksh #===============# # SCRIPTS: main # #===============# { mysql -v -v demo 2>&1 << !SQL select 'satmysql silent-ok hosts'; select host,serial_no,company,model from host order by host; !SQL } | satmysql Hosts
Comments |
This script selects summary details for all the hosts in the demo database. This is the application "entry" point.
Called by: addhost displayhost
{ mysql -v -v demo 2>&1 << !SQLThe mysql command is used to access the demo database. The verbosity of mysql is set to -v -v. All output is directed to standard output so that it will be seen by satmysql. SQL satements are read until !SQL.
select 'satmysql silent-ok hosts';When the hosts information is selected from the demo database the result is to be put into the hosts multi-column list and no messages are to be generated if the select succeeds (silent-ok).
select host,serial_no,company,model from host order by host;The hosts details are selected from the demo database.
!SQL } | satmysql HostsThe output from the mysql command is piped to satmysql. Any error messages generated by the SQL will be trapped and labeled with Hosts. For example: If the select satement is unable to select the hosts, satmysql will generate an "Unable to Select Hosts" message.