Commit a7e24eda authored by Tom Lane's avatar Tom Lane

Use explicit path to libpgtcl.so, instead of relying on LD_LIBRARY_PATH

or local equivalent.  Also, honor --with-pgport configure option for
default port number, and allow PGPORT environment variable to override
this.
parent a8b9cbfa
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # Copyright (c) 1994, Regents of the University of California
# #
# $Header: /cvsroot/pgsql/src/bin/pgaccess/Attic/Makefile,v 1.14 2000/10/20 21:03:58 petere Exp $ # $Header: /cvsroot/pgsql/src/bin/pgaccess/Attic/Makefile,v 1.15 2001/02/07 20:30:20 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -19,6 +19,8 @@ all: pgaccess ...@@ -19,6 +19,8 @@ all: pgaccess
pgaccess: pgaccess.sh $(top_builddir)/src/Makefile.global pgaccess: pgaccess.sh $(top_builddir)/src/Makefile.global
sed -e 's,@WISH@,$(WISH),g' \ sed -e 's,@WISH@,$(WISH),g' \
-e 's,@PGACCESSHOME@,$(pgaccessdir),g' \ -e 's,@PGACCESSHOME@,$(pgaccessdir),g' \
-e 's,@PGLIB@,$(libdir),g' \
-e 's,@DEF_PGPORT@,$(DEF_PGPORT),g' \
$< >$@ $< >$@
chmod a+x $@ chmod a+x $@
......
...@@ -10,8 +10,8 @@ global PgAcVar ...@@ -10,8 +10,8 @@ global PgAcVar
set PgAcVar(pref,autoload) 1 set PgAcVar(pref,autoload) 1
set PgAcVar(pref,systemtables) 0 set PgAcVar(pref,systemtables) 0
set PgAcVar(pref,lastdb) {} set PgAcVar(pref,lastdb) {}
set PgAcVar(pref,lasthost) localhost set PgAcVar(pref,lasthost) {}
set PgAcVar(pref,lastport) 5432 set PgAcVar(pref,lastport) {}
set PgAcVar(pref,username) {} set PgAcVar(pref,username) {}
set PgAcVar(pref,password) {} set PgAcVar(pref,password) {}
set PgAcVar(pref,language) english set PgAcVar(pref,language) english
......
...@@ -61,8 +61,8 @@ global PgAcVar CurrentDB ...@@ -61,8 +61,8 @@ global PgAcVar CurrentDB
foreach module {mainlib database tables queries visualqb forms views functions reports scripts users sequences schema help preferences} { foreach module {mainlib database tables queries visualqb forms views functions reports scripts users sequences schema help preferences} {
source [file join $PgAcVar(PGACCESS_HOME) lib $module.tcl] source [file join $PgAcVar(PGACCESS_HOME) lib $module.tcl]
} }
set PgAcVar(currentdb,host) localhost set PgAcVar(currentdb,host) [default_pg_host]
set PgAcVar(currentdb,pgport) 5432 set PgAcVar(currentdb,pgport) [default_pg_port]
set CurrentDB {} set CurrentDB {}
set PgAcVar(tablist) [list Tables Queries Views Sequences Functions Reports Forms Scripts Users Schema] set PgAcVar(tablist) [list Tables Queries Views Sequences Functions Reports Forms Scripts Users Schema]
set PgAcVar(activetab) {} set PgAcVar(activetab) {}
...@@ -73,6 +73,19 @@ global PgAcVar CurrentDB ...@@ -73,6 +73,19 @@ global PgAcVar CurrentDB
Preferences::load Preferences::load
} }
proc default_pg_host {} {
return localhost
}
proc default_pg_port {} {
global env
if {[info exists env(PGPORT)]} {
return $env(PGPORT)
} else {
return 5432
}
}
proc {wpg_exec} {db cmd} { proc {wpg_exec} {db cmd} {
global PgAcVar global PgAcVar
set PgAcVar(pgsql,cmd) "never executed" set PgAcVar(pgsql,cmd) "never executed"
...@@ -165,15 +178,20 @@ global PgAcVar CurrentDB ...@@ -165,15 +178,20 @@ global PgAcVar CurrentDB
proc {main} {argc argv} { proc {main} {argc argv} {
global PgAcVar CurrentDB tcl_platform global PgAcVar CurrentDB tcl_platform env
load libpgtcl[info sharedlibextension] if {[info exists env(PGLIB)]} {
set libpgtclpath [file join $env(PGLIB) libpgtcl]
} else {
set libpgtclpath {libpgtcl}
}
load ${libpgtclpath}[info sharedlibextension]
catch {Mainlib::draw_tabs} catch {Mainlib::draw_tabs}
set PgAcVar(opendb,username) {} set PgAcVar(opendb,username) {}
set PgAcVar(opendb,password) {} set PgAcVar(opendb,password) {}
if {$argc>0} { if {$argc>0} {
set PgAcVar(opendb,dbname) [lindex $argv 0] set PgAcVar(opendb,dbname) [lindex $argv 0]
set PgAcVar(opendb,host) localhost set PgAcVar(opendb,host) [default_pg_host]
set PgAcVar(opendb,pgport) 5432 set PgAcVar(opendb,pgport) [default_pg_port]
Mainlib::open_database Mainlib::open_database
} elseif {$PgAcVar(pref,autoload) && ($PgAcVar(pref,lastdb)!="")} { } elseif {$PgAcVar(pref,autoload) && ($PgAcVar(pref,lastdb)!="")} {
set PgAcVar(opendb,dbname) $PgAcVar(pref,lastdb) set PgAcVar(opendb,dbname) $PgAcVar(pref,lastdb)
......
...@@ -2,8 +2,12 @@ ...@@ -2,8 +2,12 @@
PATH_TO_WISH='@WISH@' PATH_TO_WISH='@WISH@'
PGACCESS_HOME='@PGACCESSHOME@' PGACCESS_HOME='@PGACCESSHOME@'
PGLIB='@PGLIB@'
PGPORT="${PGPORT:-@DEF_PGPORT@}"
export PATH_TO_WISH export PATH_TO_WISH
export PGACCESS_HOME export PGACCESS_HOME
export PGLIB
export PGPORT
exec "${PATH_TO_WISH}" "${PGACCESS_HOME}/main.tcl" "$@" exec "${PATH_TO_WISH}" "${PGACCESS_HOME}/main.tcl" "$@"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment