head	1.2;
access;
symbols;
locks; strict;
comment	@# @;


1.2
date	93.07.02.21.21.30;	author terry;	state Exp;
branches;
next	1.1;

1.1
date	93.05.14.18.58.41;	author jimbo;	state Exp;
branches;
next	;


desc
@@


1.2
log
@I added the 2 options to call query tool, one to run, one to save.
I changed pgbrowse to accomadate in the -query option
@
text
@#!/usr/local/bin/wish -f

set PGB(WishLocation) /usr/local/bin/wish

if [info exists env(PGBROWSE)] {
	set PGB(Home) $env(PGBROWSE)
} else {
	set PGB(Home) /usr/local/pgbrowse
}
if ![file exists $PGB(Home)/lib/pg_browse.tcl] {
	error "$PGB(Home) is not the PGBROWSE installation directory.\nPlease set your PGBROWSE environment variable to the correct location."
	exit 1
}

set PGB(Tmp) /tmp
if [info exists env(TMPDIR)] {
	if [file writable $env(TMPDIR)] {set PGB(Tmp) $env(TMPDIR)}
}
if [info exists env(PGHOST)] {
       	set PGB(Host) $env(PGHOST)
} else {
       	set PGB(Host) "heel.s2k.berkeley.edu"
}
if [info exists env(PGBACTIONINIT)] {
	set PGB(ActionInit) $env(PGBACTIONINIT)
} else {
	set PGB(ActionInit) pgb.tcl
}

set PGB(ActionDirs) {}
if [info exists env(PGBACTIONS)] {
	lappend PGB(ActionDirs) [split $env(PGBACTIONS) :]
}
foreach dir [glob -nocomplain $PGB(Home)/actions/*] {
	if {[file isdirectory $dir] && [lsearch $PGB(ActionDirs) $dir] == -1} {
		lappend PGB(ActionDirs) $dir
	}
}


set BITMAPDIR $PGB(Home)/bitmaps
set HELPDIR $PGB(Home)/help
source $PGB(Home)/lib/tkutils.tcl
source $PGB(Home)/lib/infobars.tcl
source $PGB(Home)/lib/FD.tcl
source $PGB(Home)/lib/pg_browse.tcl
source $PGB(Home)/lib/pg_query.tcl
source $PGB(Home)/lib/pg_action.tcl
source $PGB(Home)/lib/pg_create.tcl
source $PGB(Home)/lib/pg_guibuilder.tcl


set tmplogfile $PGB(Tmp)/PGBrowse.[GetAPid]
set logfile $tmplogfile
set host $PGB(Host)
set db {}
set class {}
if [catch {ParseArgs {debug :host :logfile showlog query :db :class} $argv}] {
	UsageExit
}
set PGB(Db) $db
set PGB(Class) $class
set PGB(Logfile) $logfile
if {$PGB(Logfile) != $tmplogfile} {
	set PGB(UserSpecifiedLog) 1
} else {
	set PGB(UserSpecifiedLog) 0
}
set PGB(Host) $host
set PGB(Debug) $debug

if [catch {set PGB(Logfd) [open $PGB(Logfile) w+]} err] {
	error "Couldn't open log file: $err"
	destroy .
	exit 1
}

ReadPGTypes
ScanActionDirs
InitPGBRoot
if $showlog OpenLog
GetDbs
GetClasses $db
GetAttributes $class
#if $query QueryClass
if {$query && $db != {} && $class != {}} {pg_gui 0}

unset db class logfile showlog query
@


1.1
log
@Initial revision
@
text
@d86 1
a86 1
if {$query && $db != {} && $class != {}} pg_gui
@
