2001-12-17 00:16:48 +00:00
|
|
|
--TEST--
|
|
|
|
PostgreSQL create db
|
|
|
|
--SKIPIF--
|
|
|
|
<?php include("skipif.inc"); ?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
2014-02-16 03:22:52 +00:00
|
|
|
// create test table
|
2003-05-20 00:14:46 +00:00
|
|
|
|
|
|
|
include('config.inc');
|
|
|
|
|
|
|
|
$db = pg_connect($conn_str);
|
2014-02-16 03:22:52 +00:00
|
|
|
if (!@pg_num_rows(@pg_query($db, "SELECT * FROM ".$table_name)))
|
2003-05-20 00:14:46 +00:00
|
|
|
{
|
2014-02-16 03:22:52 +00:00
|
|
|
pg_query($db,$table_def); // Create table here
|
2003-05-20 00:14:46 +00:00
|
|
|
for ($i=0; $i < $num_test_record; $i++) {
|
|
|
|
pg_query($db,"INSERT INTO ".$table_name." VALUES ($i, 'ABC');");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
echo pg_last_error()."\n";
|
|
|
|
}
|
|
|
|
|
2014-02-16 09:08:50 +00:00
|
|
|
$v = pg_version();
|
|
|
|
if (version_compare($v['server'], '9.2', '>=') && !@pg_num_rows(@pg_query($db, "SELECT * FROM ".$table_name_92)))
|
2014-02-16 03:22:52 +00:00
|
|
|
{
|
|
|
|
pg_query($db,$table_def_92); // Create table here
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
echo pg_last_error()."\n";
|
|
|
|
}
|
|
|
|
|
2003-05-20 00:14:46 +00:00
|
|
|
pg_close($db);
|
|
|
|
|
|
|
|
echo "OK";
|
2001-12-17 00:16:48 +00:00
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
OK
|