home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
dbcorpch.tcl
< prev
next >
Wrap
Text File
|
1996-10-03
|
2KB
|
74 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 :
#
#---------------------------------------------------------------------------
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: cbcorpch.tcl <resultFile> <name>=<value> ..."
}
if ![db connected] {
finish 1 $file "Could not connect to database."
}
db begin
db update corporate0
foreach pair [lrange $argv 1 end] {
set list [split $pair =]
set name [lindex $list 0]
set value [lindex $list 1]
db set -s $name $value
}
if [catch {db run} error] {
catch {db rollback}
finish 1 $file $error
}
if [catch {db commit} error] {
finish 1 $file $error
}
finish 0 $file "done"