Back to index

php5  5.3.10
skipif.inc
Go to the documentation of this file.
00001 <?php
00002 // This script prints "skip" unless:
00003 // * the pgsql extension is built-in or loadable, AND
00004 // * there is a database called "test" accessible
00005 //   with no username/password, AND
00006 // * we have create/drop privileges on the entire "test"
00007 //   database
00008 
00009 include("config.inc");
00010 include("lcmess.inc");
00011 
00012 if (!extension_loaded("pgsql")) {
00013     die("skip\n");
00014 }
00015 $conn = @pg_connect($conn_str);
00016 if (!is_resource($conn)) {
00017     die("skip could not connect\n");
00018 }
00019 
00020 function skip_server_version($version, $op = '<') { _skip_version('server', $version, $op); }
00021 function skip_client_version($version, $op = '<') { _skip_version('client', $version, $op); }
00022 
00023 
00024 function _skip_version($type, $version, $op)
00025 {
00026        $pg = pg_parameter_status($type.'_version');
00027        if (version_compare($pg, $version, $op)) {
00028               die("skip {$type} version {$pg} is {$op} {$version}\n");
00029        }
00030 }
00031 
00032 ?>