Index: openacs-4/packages/acs-bootstrap-installer/acs-bootstrap-installer.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/acs-bootstrap-installer.info,v diff -u -N -r1.43 -r1.44 --- openacs-4/packages/acs-bootstrap-installer/acs-bootstrap-installer.info 22 Jan 2018 00:15:23 -0000 1.43 +++ openacs-4/packages/acs-bootstrap-installer/acs-bootstrap-installer.info 3 Jul 2018 17:58:48 -0000 1.44 @@ -9,7 +9,7 @@ f t - + Don Baccus Bootstraps an OpenACS installation. 2017-08-06 @@ -18,7 +18,7 @@ GPL 3 - + Index: openacs-4/packages/acs-bootstrap-installer/tcl/20-db-bootstrap-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/tcl/20-db-bootstrap-procs.tcl,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/acs-bootstrap-installer/tcl/20-db-bootstrap-procs.tcl 21 May 2018 16:40:47 -0000 1.11 +++ openacs-4/packages/acs-bootstrap-installer/tcl/20-db-bootstrap-procs.tcl 3 Jul 2018 17:58:48 -0000 1.12 @@ -32,6 +32,7 @@ foreach dbn [nsv_array names db_available_pools] { foreach pool [db_available_pools $dbn] { nsv_set db_pool_to_dbn $pool $dbn + set ::acs::db_pool_to_dbn($pool) $dbn } } } Index: openacs-4/packages/acs-tcl/acs-tcl.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/acs-tcl.info,v diff -u -N -r1.86 -r1.87 --- openacs-4/packages/acs-tcl/acs-tcl.info 1 Jul 2018 09:59:57 -0000 1.86 +++ openacs-4/packages/acs-tcl/acs-tcl.info 3 Jul 2018 17:58:48 -0000 1.87 @@ -9,7 +9,7 @@ f t - + OpenACS The Kernel Tcl API library. 2017-08-06 @@ -18,8 +18,8 @@ GPL version 2 3 - - + + Index: openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl,v diff -u -N -r1.102 -r1.103 --- openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 17 May 2018 14:42:03 -0000 1.102 +++ openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 3 Jul 2018 17:58:48 -0000 1.103 @@ -173,20 +173,38 @@ a db handle, not the dbn that handle came from. Therefore, they instead use -handle_p 1 and pass the db handle. + Hmm, as of 2018, it seems that in most cases, db_driverkey is + called with a handle. + @return The driverkey for use in db_* API switch statements. @author Andrew Piskorski (atp@piskorski.com) @creation-date 2003/04/08 } { - set proc_name {db_driverkey} - if { $handle_p } { - set handle $dbn ; set dbn {} + # + # In the case, the passed "dbn" is actually a + # handle. Determine from the handle the "pool" and from the + # "pool" the "dbn". + # + set handle $dbn set pool [ns_db poolname $handle] - - if { [nsv_exists db_pool_to_dbn $pool] } { + set key ::acs::db_pool_to_dbn($pool) + if {[info exists $key]} { + # + # First, try to get the variable from the per-thread + # variable (which is part of the blueprint). + # + set dbn [set $key] + } elseif { [nsv_exists db_pool_to_dbn $pool] } { + # + # Fallback to nsv (old style), when for whatever + # reasonesm, the namespaced variable is not available. + # + ns_log notice "db_driverkey $handle_p dbn <$dbn> VIA NSV" set dbn [nsv_get db_pool_to_dbn $pool] } else { + # # db_pool_to_dbn_init runs on startup, so other than some # broken code deleting the nsv key (very unlikely), the # only way this could happen is for someone to call this @@ -196,7 +214,7 @@ error "No database name (dbn) found for pool '$pool'. Check the 'ns/server/[ns_info server]/acs/database' section of your config file." } } - + set key ::acs::db_driverkey($dbn) if {[info exists $key]} { return [set $key] @@ -225,7 +243,7 @@ set driverkey "nsodbc" } else { set driverkey {} - ns_log Error "$proc_name: Unknown driver '$driver'." + ns_log Error "db_driverkey: Unknown driver '$driver'." } nsv_set db_driverkey $dbn $driverkey