[development] hook_install: pgsql: check version number

Daniel Convissor danielc at analysisandsolutions.com
Mon Mar 6 19:58:36 UTC 2006


On Mon, Mar 06, 2006 at 09:44:57AM -0500, Daniel Convissor wrote:

> function get_db_server_version() {
>   static $version;
> 
>   if (isset($version)) {
>     return $version;
>   }

Hmm...  Upon further thought, that line will need tweaking because in 
testing and edge cases, the database connection may get changed.  So, 
perhaps something like this:

 function get_db_server_version() {
   static $version, $prior_active_db;
 
   if (isset($version) && isset($prior_active_db) && $prior_active_db == $GLOBALS['active_db']) {
     return $version;
   }
   $prior_active_db = $GLOBALS['active_db'];

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409


More information about the development mailing list