xref: /PHP-5.3/ext/pgsql/tests/skipif.inc (revision 18b8a3bc)
1<?php
2// This script prints "skip" unless:
3// * the pgsql extension is built-in or loadable, AND
4// * there is a database called "test" accessible
5//   with no username/password, AND
6// * we have create/drop privileges on the entire "test"
7//   database
8
9include("config.inc");
10include("lcmess.inc");
11
12if (!extension_loaded("pgsql")) {
13    die("skip\n");
14}
15$conn = @pg_connect($conn_str);
16if (!is_resource($conn)) {
17    die("skip could not connect\n");
18}
19
20function skip_server_version($version, $op = '<') { _skip_version('server', $version, $op); }
21function skip_client_version($version, $op = '<') { _skip_version('client', $version, $op); }
22
23
24function _skip_version($type, $version, $op)
25{
26	$pg = pg_parameter_status($type.'_version');
27	if (version_compare($pg, $version, $op)) {
28		die("skip {$type} version {$pg} is {$op} {$version}\n");
29	}
30}
31
32?>
33