home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
dbcorpinfo.tcl
< prev
next >
Wrap
Text File
|
1996-10-01
|
2KB
|
67 lines
#---------------------------------------------------------------------------
#
# Copyright (c) 1996 by Cayenne Software Inc.
#
# This software is furnished under a license and may be used only in
# accordance with the terms of such license and with the inclusion of
# the above copyright notice. This software or any other copies thereof
# may not be provided or otherwise made available to any other person.
# No title to and ownership of the software is hereby transferred.
#
# The information in this software is subject to change without notice
# and should not be construed as a commitment by Cayenne Software Inc.
#
#---------------------------------------------------------------------------
#
# File : %W%
# Author : edri
# Original date : 16-9-1996
# Description : dbserver script to retrieve corporate info
#---------------------------------------------------------------------------
proc finish {code file result} {
if {$code == 0} {
puts $file OK
} else {
puts $file ERROR
}
puts $file $result
close $file
exit $code
}
set resultFile [lindex $argv 0]
if {$resultFile == ""} {
puts stderr "No result file as first argument specified."
exit 1
}
if [catch {set file [open $resultFile w]} error] {
puts stderr $error
exit 1
}
if {[llength $argv] != 1} {
finish 1 $file "Usage: dbcorpinfo.tcl <resultFile>"
}
if ![db connected] {
finish 1 $file "Could not connect to database."
}
db select -s c_id
db select -s c_name
db select -s c_release
db select -s c_directory
db from corporate0
if [catch {set info [db run]} error] {
finish 1 $file $error
}
if [db nothing] {
finish 1 $file "Corporate object not found in database."
}
finish 0 $file $info