summaryrefslogtreecommitdiff
path: root/ext/pgsql/tests/01createdb.phpt
blob: aa2e43748fae9b73c42ffb721400c27c73f99cef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--TEST--
PostgreSQL create db
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
// create test table

include('config.inc');

$db = pg_connect($conn_str);
if (!@pg_num_rows(@pg_query($db, "SELECT * FROM ".$table_name)))
{
	pg_query($db,$table_def); // Create table here
	for ($i=0; $i < $num_test_record; $i++) {
		pg_query($db,"INSERT INTO ".$table_name." VALUES ($i, 'ABC');");
	}
}
else {
	echo pg_last_error()."\n";
}

$v = pg_version();
if (version_compare($v['server'], '9.2', '>=') && !@pg_num_rows(@pg_query($db, "SELECT * FROM ".$table_name_92)))
{
	pg_query($db,$table_def_92); // Create table here
}
else {
	echo pg_last_error()."\n";
}

// Create view here
pg_query($db,$view_def);

pg_close($db);

echo "OK";
?>
--EXPECT--
OK