home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # Copyright (c) 1993-1995 by Cadre Technologies 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 Cadre Technologies Inc.
- #
- #---------------------------------------------------------------------------
- #
- # File : @(#)tdbop.tcl 2.1
- # Original date : 20-4-1993
- # Description : Perform TDB Operations
- #
- #---------------------------------------------------------------------------
- #
-
- source [m4_path_name tcl cginit.tcl]
-
- require wmt_util.tcl
- require tdbop_msg.tcl
- require subtdbop.tcl
-
- proc getCurrentHost {} {
- if {! [catch {exec hostname} thishost] ||
- ! [catch {exec "uname -n"} thishost]} {
- return $thishost
- }
- return ""
- }
-
- proc isCurrentHost {host} {
- return [expr {([getCurrentHost] == $host) ? 1 : 0}]
- }
-
-
- proc tdbop {} {
- OTShRegister::tdbOp
-
- set command [lvarpop argv]
-
- unpack_package
-
- set tdbName [lvarpop argv]
- set tdbHost [lvarpop argv]
-
- if {$tdbName == ""} {
- m4_error $E_NO_TDB $command
- return
- }
-
- if {($command == "createDatabase") || ($command == "dropDatabase")} {
- $command $tdbHost $tdbName
- return
- }
-
- if {$command == "executeSQL"} {
- #
- # Expand the SQL statements and execute them
- #
-
- set textSection [TextSection new]
- if [catch {
- foreach file $argv {
- expand_file $textSection $file textSection $textSection
- m4_message $M_CAT_MON $file
- }
- } reason] {
- m4_error $E_CAT_MON $reason
- }
-
- executeCommandWithConnect $textSection $tdbHost $tdbName
-
- return
- }
-
- m4_error $E_UNKNOWN_SUBCMND $command
- }
-
- #
- # Start tdbop
- #
-
- if [catch {tdbop} ] {
- puts stderr $errorInfo
- }
-