]> granicus.if.org Git - php/commitdiff
Reorganized tests
authorMarcus Boerger <helly@php.net>
Tue, 20 May 2003 00:14:46 +0000 (00:14 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 20 May 2003 00:14:46 +0000 (00:14 +0000)
47 files changed:
ext/pgsql/tests/01createdb.phpt
ext/pgsql/tests/02connection.phpt
ext/pgsql/tests/03sync_query.phpt
ext/pgsql/tests/04async_query.phpt
ext/pgsql/tests/05large_object.phpt
ext/pgsql/tests/06copy.phpt
ext/pgsql/tests/07optional.phpt
ext/pgsql/tests/08escape.phpt
ext/pgsql/tests/09notice.phpt
ext/pgsql/tests/10pg_convert.phpt
ext/pgsql/tests/11pg_meta_data.phpt
ext/pgsql/tests/12pg_insert.phpt
ext/pgsql/tests/13pg_select.phpt
ext/pgsql/tests/14pg_update.phpt
ext/pgsql/tests/15pg_delete.phpt
ext/pgsql/tests/16pg_result_status.phpt
ext/pgsql/tests/17result.phpt
ext/pgsql/tests/18pg_escape_bytea.phpt
ext/pgsql/tests/19pg_ping.phpt
ext/pgsql/tests/20pg_get_pid.phpt
ext/pgsql/tests/21pg_get_notify.phpt
ext/pgsql/tests/98old_api.phpt
ext/pgsql/tests/9999dropdb.phpt
ext/pgsql/tests/async_query.inc [deleted file]
ext/pgsql/tests/connection.inc [deleted file]
ext/pgsql/tests/copy.inc [deleted file]
ext/pgsql/tests/createdb.inc [deleted file]
ext/pgsql/tests/dropdb.inc [deleted file]
ext/pgsql/tests/escape.inc [deleted file]
ext/pgsql/tests/informational.inc [deleted file]
ext/pgsql/tests/large_object.inc [deleted file]
ext/pgsql/tests/notice.inc [deleted file]
ext/pgsql/tests/old_api.inc [deleted file]
ext/pgsql/tests/optional.inc [deleted file]
ext/pgsql/tests/pg_convert.inc [deleted file]
ext/pgsql/tests/pg_delete.inc [deleted file]
ext/pgsql/tests/pg_escape_bytea.inc [deleted file]
ext/pgsql/tests/pg_get_notify.inc [deleted file]
ext/pgsql/tests/pg_get_pid.inc [deleted file]
ext/pgsql/tests/pg_insert.inc [deleted file]
ext/pgsql/tests/pg_meta_data.inc [deleted file]
ext/pgsql/tests/pg_ping.inc [deleted file]
ext/pgsql/tests/pg_result_status.inc [deleted file]
ext/pgsql/tests/pg_select.inc [deleted file]
ext/pgsql/tests/pg_update.inc [deleted file]
ext/pgsql/tests/result.inc [deleted file]
ext/pgsql/tests/sync_query.inc [deleted file]

index 3b34ed537e6d21bf5fbfbe8acee2468e9ad7e5a2..15849396c61138b15eaa52b4c43eaf065a43d79c 100644 (file)
@@ -4,7 +4,25 @@ PostgreSQL create db
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("createdb.inc");
+// 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";
+}
+
+pg_close($db);
+
+echo "OK";
 ?>
 --EXPECT--
 OK
index fd1333dfe6eedcbeaf1c17ac25782a7e9f4eff1a..f1258f6df1375d091ec9c82a98dec2565b7034aa 100644 (file)
@@ -4,7 +4,47 @@ PostgreSQL connection
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("connection.inc");
+// connection function tests
+
+include('config.inc');
+
+$db = pg_pconnect($conn_str);
+if (pg_connection_status($db) != PGSQL_CONNECTION_OK) 
+{
+       echo "pg_connection_status() error\n";
+}
+if (!pg_connection_reset($db)) 
+{
+       echo "pg_connection_reset() error\n";
+}
+if (pg_connection_busy($db)) 
+{
+       echo "pg_connection_busy() error\n";
+}
+if (!pg_host($db)) 
+{
+       echo "pg_host() error\n";
+}
+if (!pg_dbname($db)) 
+{
+       echo "pg_dbname() error\n";
+}
+if (!pg_port($db)) 
+{
+       echo "pg_port() error\n";
+}
+if (pg_tty($db)) 
+{
+       echo "pg_tty() error\n";
+}
+if (pg_options($db)) 
+{
+       echo "pg_options() error\n";
+}
+
+pg_close($db);
+
+echo "OK";
 ?>
 --EXPECT--
 OK
index 0f2e04895913146f36573847ecce205a1644e426..c65426d7d89c607ca77f0633d77887b8da872f8b 100644 (file)
@@ -4,7 +4,50 @@ PostgreSQL sync query
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("sync_query.inc");
+
+include('config.inc');
+
+$db = pg_connect($conn_str);
+
+$result = pg_query($db, "SELECT * FROM ".$table_name.";");
+if (!($rows   = pg_num_rows($result)))
+{
+       echo "pg_num_row() error\n";
+}
+for ($i=0; $i < $rows; $i++) 
+{
+       pg_fetch_array($result, $i, PGSQL_NUM);
+}
+for ($i=0; $i < $rows; $i++) 
+{
+       pg_fetch_object($result, $i, PGSQL_ASSOC);
+}
+for ($i=0; $i < $rows; $i++) 
+{
+       pg_fetch_row($result, $i);
+}
+for ($i=0; $i < $rows; $i++) 
+{
+       pg_fetch_result($result, $i, 0);
+}
+
+pg_result_error($result);
+pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";"));
+pg_num_fields(pg_query($db, "SELECT * FROM ".$table_name.";"));
+pg_field_name($result, 0);
+pg_field_num($result, $field_name);
+pg_field_size($result, 0);
+pg_field_type($result, 0);
+pg_field_prtlen($result, 0);
+pg_field_is_null($result, 0);
+
+$result = pg_query($db, "INSERT INTO ".$table_name." VALUES (9999, 'ABC');");
+pg_last_oid($result);
+
+pg_free_result($result);
+pg_close($db);
+
+echo "OK";
 ?>
 --EXPECT--
 OK
index a3d17699b9dfafdd1706de2cd67aa579e1438677..15728ec1ee863da16137105534f92381f2fa762e 100644 (file)
@@ -4,7 +4,62 @@ PostgreSQL async query
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("async_query.inc");
+
+include('config.inc');
+
+$db = pg_connect($conn_str);
+
+if (!pg_send_query($db, "SELECT * FROM ".$table_name.";")) {
+       echo "pg_send_query() error\n";
+}
+while(pg_connection_busy($db));  // busy wait: intended
+if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
+       echo "pg_connection_status() error\n";
+}
+if (!($result = pg_get_result($db))) 
+{
+       echo "pg_get_result() error\n";
+}
+
+if (!($rows = pg_num_rows($result))) {
+       echo "pg_num_rows() error\n";
+}
+for ($i=0; $i < $rows; $i++) 
+{
+       pg_fetch_array($result, $i, PGSQL_NUM);
+}
+for ($i=0; $i < $rows; $i++) 
+{
+       pg_fetch_object($result, $i, PGSQL_ASSOC);
+}
+for ($i=0; $i < $rows; $i++) 
+{
+       pg_fetch_row($result, $i);
+}
+for ($i=0; $i < $rows; $i++) 
+{
+       pg_fetch_result($result, $i, 0);
+}
+
+pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";"));
+pg_num_fields(pg_query($db, "SELECT * FROM ".$table_name.";"));
+pg_field_name($result, 0);
+pg_field_num($result, $field_name);
+pg_field_size($result, 0);
+pg_field_type($result, 0);
+pg_field_prtlen($result, 0);
+pg_field_is_null($result, 0);
+
+if (!pg_send_query($db, "INSERT INTO ".$table_name." VALUES (8888, 'GGG');")) 
+{
+       echo "pg_send_query() error\n";
+}
+
+pg_last_oid($result);
+pg_free_result($result);
+
+
+echo "OK";
 ?>
 --EXPECT--
 OK
index ef0bc15db9db604ec53d665f47e0c2bd018db03e..4f8683625afc6c98a19116e1d0527e078c4207e8 100644 (file)
@@ -4,7 +4,70 @@ PostgreSQL large object
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("large_object.inc");
+
+include('config.inc');
+
+$db = pg_connect($conn_str);
+
+// create/write/close LO
+pg_exec ($db, "begin");
+$oid = pg_lo_create ($db);
+if (!$oid) echo ("pg_lo_create() error\n");
+$handle = pg_lo_open ($db, $oid, "w");
+if (!$handle) echo ("pg_lo_open() error\n");
+pg_lo_write ($handle, "large object data\n");
+pg_lo_close ($handle);
+pg_exec ($db, "commit");
+
+// open/read/tell/seek/close LO
+pg_exec ($db, "begin");
+$handle = pg_lo_open ($db, $oid, "w");
+pg_lo_read($handle, 100);
+pg_lo_tell($handle);
+pg_lo_seek($handle, 2);
+pg_lo_close($handle);
+pg_exec ($db, "commit");
+
+// open/read_all/close LO
+pg_exec ($db, "begin");
+$handle = pg_lo_open ($db, $oid, "w");
+pg_lo_read_all($handle);
+if (pg_last_error()) echo "pg_lo_read_all() error\n".pg_last_error();
+pg_lo_close($handle);
+pg_exec ($db, "commit");
+
+// unlink LO
+pg_exec ($db, "begin");
+pg_lo_unlink($db, $oid) or print("pg_lo_unlink() error\n");
+pg_exec ($db, "commit");
+
+// more pg_lo_unlink() tests
+// Test without connection 
+pg_exec ($db, "begin");
+$oid = pg_lo_create ($db) or print("pg_lo_create() error\n");
+pg_lo_unlink($oid) or print("pg_lo_unlink() error\n");
+pg_exec ($db, "commit");
+
+// Test with string oid value
+pg_exec ($db, "begin");
+$oid = pg_lo_create ($db) or print("pg_lo_create() error\n");
+pg_lo_unlink($db, (string)$oid) or print("pg_lo_unlink() error\n");
+pg_exec ($db, "commit");
+
+// import/export LO
+pg_query($db, 'begin');
+$oid = pg_lo_import($db, 'php.gif');
+pg_query($db, 'commit');
+pg_query($db, 'begin');
+@unlink('php.gif.exported');
+pg_lo_export($oid, 'php.gif.exported', $db);
+if (!file_exists('php.gif.exported')) {
+       echo "Export failed\n";
+}
+@unlink('php.gif.exported');
+pg_query($db, 'commit');
+
+echo "OK";
 ?>
 --EXPECT--
 large object data
index dbbe1ff4d6d0315bfa4113ea95f8c1731f859586..e5823c43a5bc5845f168dcc7cbf804151958d5fd 100644 (file)
@@ -4,7 +4,12 @@ PostgreSQL copy functions
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("copy.inc");
+
+include('config.inc');
+
+
+echo "OK";
+
 ?>
 --EXPECT--
 OK
index f8b8cbeec7a3f4ce8e8eea41bd60c98a765e26a3..e73a9cffe07b808575f271278e0e04787c65a37a 100644 (file)
@@ -4,7 +4,16 @@ PostgreSQL optional functions
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("optional.inc");
+// optional functions
+
+include('config.inc');
+
+$db = pg_connect($conn_str);
+$enc = pg_client_encoding($db);
+
+pg_set_client_encoding($db, $enc);
+
+echo "OK";
 ?>
 --EXPECT--
 OK
index e6a8cf8731274cfc2e6d532ba0680efd9988fe95..aa24a4512ef0dfb159ca1fd0129b75832eadfe45 100644 (file)
@@ -4,7 +4,63 @@ PostgreSQL escape functions
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("escape.inc");
+
+include 'config.inc';
+define('FILE_NAME', './php.gif');
+
+// pg_escape_string() test
+$before = "ABC\\ABC\'";
+$expect  = "ABC\\\\ABC\\'";
+$after = pg_escape_string($before);
+if ($expect === $after) {
+       echo "pg_escape_string() is Ok\n";
+}
+else {
+       echo "pg_escape_string() is NOT Ok\n";
+       var_dump($before);
+       var_dump($after);
+       var_dump($expect);
+}
+
+// pg_escape_bytea() test
+$before = "ABC\\ABC";
+$expect  = "ABC\\\\\\\\ABC";
+$after  = pg_escape_bytea($before);
+if ($expect === $after) {
+       echo "pg_escape_bytea() is Ok\n";
+}
+else {
+       echo "pg_escape_byte() is NOT Ok\n";
+       var_dump($before);
+       var_dump($after);
+       var_dump($expect);
+}
+
+// Test using database
+$fp   = fopen(FILE_NAME,'r');
+$data = fread($fp, filesize(FILE_NAME));
+$db   = pg_connect($conn_str);
+
+// Insert binary to DB
+$escaped_data = pg_escape_bytea($data);
+pg_query("DELETE FROM ".$table_name." WHERE num = -9999;");
+$sql = "INSERT INTO ".$table_name." (num, bin) VALUES (-9999, CAST ('".$escaped_data."' AS BYTEA));";
+pg_query($db, $sql);
+
+// Retrieve binary from DB
+$sql = "SELECT bin::bytea FROM ".$table_name." WHERE num = -9999";
+$result = pg_query($db, $sql);
+$row = pg_fetch_array($result, 0, PGSQL_ASSOC);
+
+// Compare
+// Need to wait PostgreSQL 7.3.x for PQunescapeBytea()
+// if ($data === pg_unescape_bytea($row['bin'])) {
+//     echo "pg_escape_bytea() actually works with databse\n";
+// }
+// else {
+//     echo "pg_escape_bytea() is broken\n";
+// }
+
 ?>
 --EXPECT--
 pg_escape_string() is NOT Ok
index f50bc707028cab771a128fc48a3cf2e0f25f24fe..ef56b8dadc88634d5bc9dc6345c2b976a31fe6b7 100644 (file)
@@ -4,7 +4,22 @@ PostgreSQL notice function
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("notice.inc");
+include 'config.inc';
+
+ini_set('pgsql.log_notice',1);
+
+$db = pg_connect($conn_str);
+pg_query($db, "BEGIN;");
+pg_query($db, "BEGIN;");
+
+$msg = pg_last_notice($db);
+if ($msg === FALSE) {
+       echo "Cannot find notice message in hash\n";
+       var_dump($msg);
+}
+echo $msg;
+echo "pg_last_notice() is Ok\n";
+
 ?>
 --EXPECT--
 NOTICE:  BEGIN: already a transaction in progress
index 016c7e74d58f72ccddc6d6e4ba8ba5ef9887ba00..b88b8e5798f37c6c69dea5fd56ea4a1be38bc659 100644 (file)
@@ -4,7 +4,16 @@ PostgreSQL pg_convert()
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("pg_convert.inc");
+error_reporting(E_ALL);
+
+include 'config.inc';
+
+$db = pg_connect($conn_str);
+
+$fields = array('num'=>'1234', 'str'=>'AAA', 'bin'=>'BBB');
+$converted = pg_convert($db, $table_name, $fields);
+
+var_dump($converted);
 ?>
 --EXPECT--
 array(3) {
index 85e2d2cf0782581ab4154d0eb6d0649522e1c1dc..5726bb3128626dab704dc469e941209a3158db74 100644 (file)
@@ -4,7 +4,15 @@ PostgreSQL pg_metadata()
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("pg_meta_data.inc");
+error_reporting(E_ALL);
+
+include 'config.inc';
+
+$db = pg_connect($conn_str);
+
+$meta = pg_meta_data($db, $table_name);
+
+var_dump($meta);
 ?>
 --EXPECT--
 array(3) {
index 104b6fe662cabc0018fa3060fe2d54d3e96dc30d..8d98f220fdfb64b69debaa6f63bb04b6c909c3ec 100644 (file)
@@ -4,7 +4,17 @@ PostgreSQL pg_insert()
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("pg_insert.inc");
+error_reporting(E_ALL);
+
+include 'config.inc';
+
+$db = pg_connect($conn_str);
+$fields = array('num'=>'1234', 'str'=>'AAA', 'bin'=>'BBB');
+
+pg_insert($db, $table_name, $fields) or print "Error in test 1\n";
+echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING)."\n";
+
+echo "Ok\n";
 ?>
 --EXPECT--
 INSERT INTO php_pgsql_test (num,str,bin) VALUES (1234,'AAA','BBB');
index 43c94c037f07d58211fa896c0977951827f1a5c5..55e88db731c9b047f34f01cbbabb282b0c4c14be 100644 (file)
@@ -4,7 +4,19 @@ PostgreSQL pg_select()
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("pg_select.inc");
+error_reporting(E_ALL);
+
+include 'config.inc';
+
+$db = pg_connect($conn_str);
+$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ');
+$ids = array('num'=>'1234');
+
+$res = pg_select($db, $table_name, $ids) or print "Error\n";
+var_dump($res);
+echo pg_select($db, $table_name, $ids, PGSQL_DML_STRING)."\n";
+echo "Ok\n";
+
 ?>
 --EXPECT--
 array(1) {
index 7dd4dd2d957745549f95cb76de2c4e5e15445df7..ef8d7e49bd2399ecd1337135b426db555c8cd927 100644 (file)
@@ -4,7 +4,18 @@ PostgreSQL pg_update()
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("pg_update.inc");
+error_reporting(E_ALL);
+
+include 'config.inc';
+
+$db = pg_connect($conn_str);
+$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ');
+$ids = array('num'=>'1234');
+
+pg_update($db, $table_name, $fields, $ids) or print "Error in test 1\n";
+echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING)."\n";
+
+echo "Ok\n";
 ?>
 --EXPECT--
 UPDATE php_pgsql_test SET num=1234,str='ABC',bin='XYZ' WHERE num=1234;
index 331e89838331fa1a38944d4732529a7600b14123..e35f4ba78e6c39f4db06398a098943ff320fff96 100644 (file)
@@ -4,7 +4,20 @@ PostgreSQL pg_delete()
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("pg_delete.inc");
+error_reporting(E_ALL);
+
+include 'config.inc';
+
+$db = pg_connect($conn_str);
+
+$fields = array('num'=>'1234', 'str'=>'XXX', 'bin'=>'YYY');
+$ids = array('num'=>'1234');
+if (!pg_delete($db, $table_name, $ids)) {
+       echo "Error\n";
+}
+else {
+       echo "Ok\n";
+}
 ?>
 --EXPECT--
 Ok
index 6faf849e7f134096436c918762656b1df51c42ab..268dc9fd64cf34e9bac106aab4a0d2e5eda3ee6b 100644 (file)
@@ -4,7 +4,15 @@ PostgreSQL pg_result_status()
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("pg_result_status.inc");
+include 'config.inc';
+
+$db = pg_connect($conn_str);
+
+$sql = "SELECT * FROM ".$table_name." WHERE num = -2";
+$result = pg_query($db, "BEGIN;END");
+
+echo pg_result_status($result)."\n";
+echo pg_result_status($result, PGSQL_STATUS_STRING)."\n";
 ?>
 --EXPECT--
 1
index e8c3f390de5c1f516960c5b08c21d87cc3351a9b..265d00c657b6c0731537630f1cd8636b699dd1bb 100644 (file)
@@ -4,10 +4,26 @@ PostgreSQL pg_fetch_*() functions
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("result.inc");
+error_reporting(E_ALL);
+
+include 'config.inc';
+
+$db = pg_connect($conn_str);
+
+$sql = "SELECT * FROM $table_name";
+$result = pg_query($db, $sql) or die('Cannot qeury db');
+$rows = pg_num_rows($result);
+
+var_dump(pg_fetch_object($result, 1));
+var_dump(pg_fetch_array($result, 1));
+var_dump(pg_fetch_row($result, 1));
+var_dump(pg_fetch_assoc($result, 1));
+var_dump(pg_result_seek($result, 0));
+
+echo "Ok\n";
 ?>
 --EXPECT--
-object(stdClass)(3) {
+object(stdClass)#1 (3) {
   ["num"]=>
   string(1) "1"
   ["str"]=>
@@ -39,7 +55,7 @@ array(3) {
 }
 array(3) {
   ["num"]=>
-  string(1) "2"
+  string(1) "1"
   ["str"]=>
   string(3) "ABC"
   ["bin"]=>
index 08832c40da4b029c1684b30d7792e69858390c50..312c7e2f6b5b4d6600f4ff4de178448be3a54c38 100644 (file)
@@ -4,7 +4,26 @@ PostgreSQL pg_escape_bytea() functions
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("pg_escape_bytea.inc");
+// optional functions
+
+include('config.inc');
+
+$fp = fopen('php.gif', 'r');
+$image = fread($fp, filesize('php.gif'));
+$esc_image = pg_escape_bytea($image);
+
+$db = pg_connect($conn_str);
+pg_query($db, 'INSERT INTO '.$table_name.' (num, bin) VALUES (9876, \''.$esc_image.'\');');
+$result = pg_query($db, 'SELECT * FROM '.$table_name.' WHERE num = 9876');
+$rows = pg_fetch_all($result);
+$unesc_image = pg_unescape_bytea($rows[0]['bin']);
+
+if ($unesc_image !== $image) {
+       echo "NG";
+}
+else {
+       echo "OK";
+}
 ?>
 --EXPECT--
 OK
index eba678b55e7c75bb1a2b8f6cb2d6e19ef206b11f..9059bde470f3eda7c3a20d76e9e9c4b64cbcb8bc 100644 (file)
@@ -4,7 +4,12 @@ PostgreSQL pg_ping() functions
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("pg_ping.inc");
+// optional functions
+
+include('config.inc');
+
+$db = pg_connect($conn_str);
+var_dump(pg_ping($db));
 ?>
 --EXPECT--
 bool(true)
index 9572751185fa4bfb88995aabf86ff56899dc31f3..06cdfa86563261f0adf82d979cbd2cf586a03569 100644 (file)
@@ -4,7 +4,14 @@ PostgreSQL pg_get_pid() functions
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("pg_get_pid.inc");
+// optional functions
+
+include('config.inc');
+
+$db = pg_connect($conn_str);
+$pid = pg_get_pid($db);
+
+is_integer($pid) ? print 'OK' : print 'NG';
 ?>
 --EXPECT--
 OK
index 0ff3a74a26f6f46f74db4c6b7584afd20203c94f..9171fc01aa45ba3124961dd4d72d519c157eb714 100644 (file)
@@ -4,7 +4,17 @@ PostgreSQL pg_get_notify() functions
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("pg_get_notify.inc");
+// optional functions
+
+include('config.inc');
+
+$db = pg_connect($conn_str);
+pg_query($db, 'LISTEN test_msg');
+pg_query($db, 'NOTIFY test_msg');
+
+$msg = pg_get_notify($db);
+
+isset($msg['message'],$msg['pid']) ? print 'OK' : print 'NG';
 ?>
 --EXPECT--
 OK
index c6f8070c23e24b07305715dcafbe93ac63267357..2667e097e303b7832477a41212d512ada53e327c 100644 (file)
@@ -4,7 +4,30 @@ PostgreSQL old api
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("old_api.inc");
+
+include('config.inc');
+
+$db = pg_connect($conn_str);
+$result = pg_exec("SELECT * FROM ".$table_name);
+pg_numrows($result);
+pg_numfields($result);
+pg_fieldname($result, 0);
+pg_fieldsize($result, $field_name);
+pg_fieldtype($result, 0);
+pg_fieldprtlen($result, 0);
+pg_fieldisnull($result, 0);
+
+pg_result($result,0,0);
+$result = pg_exec("INSERT INTO ".$table_name." VALUES (7777, 'KKK')");
+$oid = pg_getlastoid($result);
+pg_freeresult($result);
+pg_errormessage();
+$result = pg_exec("UPDATE ".$table_name." SET str = 'QQQ' WHERE str like 'RGD';");
+pg_cmdtuples($result);
+
+
+
+echo "OK";
 ?>
 --EXPECT--
 OK
index d60e2dce99e4d82d92860a4eb6cdc4c6ad4f935b..c60eeda8d6c1bc3cea2e02d1e092b023b12436da 100644 (file)
@@ -4,7 +4,15 @@ PostgreSQL drop db
 <?php include("skipif.inc"); ?>
 --FILE--
 <?php
-include("dropdb.inc");
+// drop test table 
+
+include('config.inc');
+
+$db = pg_connect($conn_str);
+pg_query($db, "DROP TABLE ".$table_name);
+
+echo "OK";
+
 ?>
 --EXPECT--
 OK
diff --git a/ext/pgsql/tests/async_query.inc b/ext/pgsql/tests/async_query.inc
deleted file mode 100644 (file)
index ac70809..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-include('config.inc');
-
-$db = pg_connect($conn_str);
-
-if (!pg_send_query($db, "SELECT * FROM ".$table_name.";")) {
-       echo "pg_send_query() error\n";
-}
-while(pg_connection_busy($db));  // busy wait: intended
-if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
-       echo "pg_connection_status() error\n";
-}
-if (!($result = pg_get_result($db))) 
-{
-       echo "pg_get_result() error\n";
-}
-
-if (!($rows = pg_num_rows($result))) {
-       echo "pg_num_rows() error\n";
-}
-for ($i=0; $i < $rows; $i++) 
-{
-       pg_fetch_array($result, $i, PGSQL_NUM);
-}
-for ($i=0; $i < $rows; $i++) 
-{
-       pg_fetch_object($result, $i, PGSQL_ASSOC);
-}
-for ($i=0; $i < $rows; $i++) 
-{
-       pg_fetch_row($result, $i);
-}
-for ($i=0; $i < $rows; $i++) 
-{
-       pg_fetch_result($result, $i, 0);
-}
-
-pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";"));
-pg_num_fields(pg_query($db, "SELECT * FROM ".$table_name.";"));
-pg_field_name($result, 0);
-pg_field_num($result, $field_name);
-pg_field_size($result, 0);
-pg_field_type($result, 0);
-pg_field_prtlen($result, 0);
-pg_field_is_null($result, 0);
-
-if (!pg_send_query($db, "INSERT INTO ".$table_name." VALUES (8888, 'GGG');")) 
-{
-       echo "pg_send_query() error\n";
-}
-
-pg_last_oid($result);
-pg_free_result($result);
-
-
-echo "OK";
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/connection.inc b/ext/pgsql/tests/connection.inc
deleted file mode 100644 (file)
index e6e9c14..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-// connection function tests
-
-include('config.inc');
-
-$db = pg_pconnect($conn_str);
-if (pg_connection_status($db) != PGSQL_CONNECTION_OK) 
-{
-       echo "pg_connection_status() error\n";
-}
-if (!pg_connection_reset($db)) 
-{
-       echo "pg_connection_reset() error\n";
-}
-if (pg_connection_busy($db)) 
-{
-       echo "pg_connection_busy() error\n";
-}
-if (!pg_host($db)) 
-{
-       echo "pg_host() error\n";
-}
-if (!pg_dbname($db)) 
-{
-       echo "pg_dbname() error\n";
-}
-if (!pg_port($db)) 
-{
-       echo "pg_port() error\n";
-}
-if (pg_tty($db)) 
-{
-       echo "pg_tty() error\n";
-}
-if (pg_options($db)) 
-{
-       echo "pg_options() error\n";
-}
-
-pg_close($db);
-
-echo "OK";
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/copy.inc b/ext/pgsql/tests/copy.inc
deleted file mode 100644 (file)
index 52b6e1d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-include('config.inc');
-
-
-echo "OK";
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/createdb.inc b/ext/pgsql/tests/createdb.inc
deleted file mode 100644 (file)
index b118838..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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";
-}
-
-pg_close($db);
-
-echo "OK";
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/dropdb.inc b/ext/pgsql/tests/dropdb.inc
deleted file mode 100644 (file)
index eaf33ae..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-// drop test table 
-
-include('config.inc');
-
-$db = pg_connect($conn_str);
-pg_query($db, "DROP TABLE ".$table_name);
-
-echo "OK";
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/escape.inc b/ext/pgsql/tests/escape.inc
deleted file mode 100644 (file)
index a39e1c1..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-include 'config.inc';
-define('FILE_NAME', './php.gif');
-
-// pg_escape_string() test
-$before = "ABC\\ABC\'";
-$expect  = "ABC\\\\ABC\\'";
-$after = pg_escape_string($before);
-if ($expect === $after) {
-       echo "pg_escape_string() is Ok\n";
-}
-else {
-       echo "pg_escape_string() is NOT Ok\n";
-       var_dump($before);
-       var_dump($after);
-       var_dump($expect);
-}
-
-// pg_escape_bytea() test
-$before = "ABC\\ABC";
-$expect  = "ABC\\\\\\\\ABC";
-$after  = pg_escape_bytea($before);
-if ($expect === $after) {
-       echo "pg_escape_bytea() is Ok\n";
-}
-else {
-       echo "pg_escape_byte() is NOT Ok\n";
-       var_dump($before);
-       var_dump($after);
-       var_dump($expect);
-}
-
-// Test using database
-$fp   = fopen(FILE_NAME,'r');
-$data = fread($fp, filesize(FILE_NAME));
-$db   = pg_connect($conn_str);
-
-// Insert binary to DB
-$escaped_data = pg_escape_bytea($data);
-pg_query("DELETE FROM ".$table_name." WHERE num = -9999;");
-$sql = "INSERT INTO ".$table_name." (num, bin) VALUES (-9999, CAST ('".$escaped_data."' AS BYTEA));";
-pg_query($db, $sql);
-
-// Retrieve binary from DB
-$sql = "SELECT bin::bytea FROM ".$table_name." WHERE num = -9999";
-$result = pg_query($db, $sql);
-$row = pg_fetch_array($result, 0, PGSQL_ASSOC);
-
-// Compare
-// Need to wait PostgreSQL 7.3.x for PQunescapeBytea()
-// if ($data === pg_unescape_bytea($row['bin'])) {
-//     echo "pg_escape_bytea() actually works with databse\n";
-// }
-// else {
-//     echo "pg_escape_bytea() is broken\n";
-// }
-
-?>
diff --git a/ext/pgsql/tests/informational.inc b/ext/pgsql/tests/informational.inc
deleted file mode 100644 (file)
index 120c613..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-// connection function tests
-
-include('config.inc');
-
-$db = pg_pconnect($conn_str);
-if (pg_connection_status($db) != PGSQL_CONNECTION_OK) 
-{
-       echo "pg_connection_status() error\n";
-}
-if (!pg_connection_reset($db)) 
-{
-       echo "pg_connection_reset() error\n";
-}
-if (pg_connection_busy($db)) 
-{
-       echo "pg_connection_busy() error\n";
-}
-if (!pg_host($db)) 
-{
-       echo "pg_host() error\n";
-}
-if (!pg_dbname($db)) 
-{
-       echo "pg_dbname() error\n";
-}
-if (!pg_port($db)) 
-{
-       echo "pg_port() error\n";
-}
-if (pg_tty($db)) 
-{
-       echo "pg_tty() error\n";
-}
-if (pg_options($db)) 
-{
-       echo "pg_options() error\n";
-}
-
-echo pg_host($db);
-
-
-pg_close($db);
-
-echo "OK";
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/large_object.inc b/ext/pgsql/tests/large_object.inc
deleted file mode 100644 (file)
index f21912b..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-include('config.inc');
-
-$db = pg_connect($conn_str);
-
-// create/write/close LO
-pg_exec ($db, "begin");
-$oid = pg_lo_create ($db);
-if (!$oid) echo ("pg_lo_create() error\n");
-$handle = pg_lo_open ($db, $oid, "w");
-if (!$handle) echo ("pg_lo_open() error\n");
-pg_lo_write ($handle, "large object data\n");
-pg_lo_close ($handle);
-pg_exec ($db, "commit");
-
-// open/read/tell/seek/close LO
-pg_exec ($db, "begin");
-$handle = pg_lo_open ($db, $oid, "w");
-pg_lo_read($handle, 100);
-pg_lo_tell($handle);
-pg_lo_seek($handle, 2);
-pg_lo_close($handle);
-pg_exec ($db, "commit");
-
-// open/read_all/close LO
-pg_exec ($db, "begin");
-$handle = pg_lo_open ($db, $oid, "w");
-pg_lo_read_all($handle);
-if (pg_last_error()) echo "pg_lo_read_all() error\n".pg_last_error();
-pg_lo_close($handle);
-pg_exec ($db, "commit");
-
-// unlink LO
-pg_exec ($db, "begin");
-pg_lo_unlink($db, $oid) or print("pg_lo_unlink() error\n");
-pg_exec ($db, "commit");
-
-// more pg_lo_unlink() tests
-// Test without connection 
-pg_exec ($db, "begin");
-$oid = pg_lo_create ($db) or print("pg_lo_create() error\n");
-pg_lo_unlink($oid) or print("pg_lo_unlink() error\n");
-pg_exec ($db, "commit");
-
-// Test with string oid value
-pg_exec ($db, "begin");
-$oid = pg_lo_create ($db) or print("pg_lo_create() error\n");
-pg_lo_unlink($db, (string)$oid) or print("pg_lo_unlink() error\n");
-pg_exec ($db, "commit");
-
-// import/export LO
-pg_query($db, 'begin');
-$oid = pg_lo_import($db, 'php.gif');
-pg_query($db, 'commit');
-pg_query($db, 'begin');
-@unlink('php.gif.exported');
-pg_lo_export($oid, 'php.gif.exported', $db);
-if (!file_exists('php.gif.exported')) {
-       echo "Export failed\n";
-}
-@unlink('php.gif.exported');
-pg_query($db, 'commit');
-
-echo "OK";
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/notice.inc b/ext/pgsql/tests/notice.inc
deleted file mode 100644 (file)
index 4c2b1de..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-include 'config.inc';
-
-ini_set('pgsql.log_notice',1);
-
-$db = pg_connect($conn_str);
-pg_query($db, "BEGIN;");
-pg_query($db, "BEGIN;");
-
-$msg = pg_last_notice($db);
-if ($msg === FALSE) {
-       echo "Cannot find notice message in hash\n";
-       var_dump($msg);
-}
-echo $msg;
-echo "pg_last_notice() is Ok\n";
-
-?>
diff --git a/ext/pgsql/tests/old_api.inc b/ext/pgsql/tests/old_api.inc
deleted file mode 100644 (file)
index 4995961..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-include('config.inc');
-
-$db = pg_connect($conn_str);
-$result = pg_exec("SELECT * FROM ".$table_name);
-pg_numrows($result);
-pg_numfields($result);
-pg_fieldname($result, 0);
-pg_fieldsize($result, $field_name);
-pg_fieldtype($result, 0);
-pg_fieldprtlen($result, 0);
-pg_fieldisnull($result, 0);
-
-pg_result($result,0,0);
-$result = pg_exec("INSERT INTO ".$table_name." VALUES (7777, 'KKK')");
-$oid = pg_getlastoid($result);
-pg_freeresult($result);
-pg_errormessage();
-$result = pg_exec("UPDATE ".$table_name." SET str = 'QQQ' WHERE str like 'RGD';");
-pg_cmdtuples($result);
-
-
-
-echo "OK";
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/optional.inc b/ext/pgsql/tests/optional.inc
deleted file mode 100644 (file)
index 87dbfd3..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-// optional functions
-
-include('config.inc');
-
-$db = pg_connect($conn_str);
-$enc = pg_client_encoding($db);
-
-pg_set_client_encoding($db, $enc);
-
-echo "OK";
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/pg_convert.inc b/ext/pgsql/tests/pg_convert.inc
deleted file mode 100644 (file)
index ab6e95f..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-error_reporting(E_ALL);
-
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-
-$fields = array('num'=>'1234', 'str'=>'AAA', 'bin'=>'BBB');
-$converted = pg_convert($db, $table_name, $fields);
-
-var_dump($converted);
-
-
-?>
diff --git a/ext/pgsql/tests/pg_delete.inc b/ext/pgsql/tests/pg_delete.inc
deleted file mode 100644 (file)
index 33ba80e..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-error_reporting(E_ALL);
-
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-
-$fields = array('num'=>'1234', 'str'=>'XXX', 'bin'=>'YYY');
-$ids = array('num'=>'1234');
-if (!pg_delete($db, $table_name, $ids)) {
-       echo "Error\n";
-}
-else {
-       echo "Ok\n";
-}
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/pg_escape_bytea.inc b/ext/pgsql/tests/pg_escape_bytea.inc
deleted file mode 100644 (file)
index 249c2f1..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-// optional functions
-
-include('config.inc');
-
-
-$fp = fopen('php.gif', 'r');
-$image = fread($fp, filesize('php.gif'));
-$esc_image = pg_escape_bytea($image);
-
-$db = pg_connect($conn_str);
-pg_query($db, 'INSERT INTO '.$table_name.' (num, bin) VALUES (9876, \''.$esc_image.'\');');
-$result = pg_query($db, 'SELECT * FROM '.$table_name.' WHERE num = 9876');
-$rows = pg_fetch_all($result);
-$unesc_image = pg_unescape_bytea($rows[0]['bin']);
-
-if ($unesc_image !== $image) {
-       echo "NG";
-}
-else {
-       echo "OK";
-}
-
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/pg_get_notify.inc b/ext/pgsql/tests/pg_get_notify.inc
deleted file mode 100644 (file)
index dfb4fe3..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-// optional functions
-
-include('config.inc');
-
-
-$db = pg_connect($conn_str);
-pg_query($db, 'LISTEN test_msg');
-pg_query($db, 'NOTIFY test_msg');
-
-$msg = pg_get_notify($db);
-
-isset($msg['message'],$msg['pid']) ? print 'OK' : print 'NG';
-
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/pg_get_pid.inc b/ext/pgsql/tests/pg_get_pid.inc
deleted file mode 100644 (file)
index 5aa8e7e..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-// optional functions
-
-include('config.inc');
-
-
-$db = pg_connect($conn_str);
-$pid = pg_get_pid($db);
-
-is_integer($pid) ? print 'OK' : print 'NG';
-
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/pg_insert.inc b/ext/pgsql/tests/pg_insert.inc
deleted file mode 100644 (file)
index e0777a2..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-error_reporting(E_ALL);
-
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-$fields = array('num'=>'1234', 'str'=>'AAA', 'bin'=>'BBB');
-
-pg_insert($db, $table_name, $fields) or print "Error in test 1\n";
-echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING)."\n";
-
-echo "Ok\n";
-?>
diff --git a/ext/pgsql/tests/pg_meta_data.inc b/ext/pgsql/tests/pg_meta_data.inc
deleted file mode 100644 (file)
index 4486935..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-error_reporting(E_ALL);
-
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-
-$meta = pg_meta_data($db, $table_name);
-
-var_dump($meta);
-
-
-?>
diff --git a/ext/pgsql/tests/pg_ping.inc b/ext/pgsql/tests/pg_ping.inc
deleted file mode 100644 (file)
index 2d9be9f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-// optional functions
-
-include('config.inc');
-
-$db = pg_connect($conn_str);
-var_dump(pg_ping($db));
-
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/pg_result_status.inc b/ext/pgsql/tests/pg_result_status.inc
deleted file mode 100644 (file)
index 2c03e89..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-
-$sql = "SELECT * FROM ".$table_name." WHERE num = -2";
-$result = pg_query($db, "BEGIN;END");
-
-echo pg_result_status($result)."\n";
-echo pg_result_status($result, PGSQL_STATUS_STRING)."\n";
-
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/pg_select.inc b/ext/pgsql/tests/pg_select.inc
deleted file mode 100644 (file)
index 4d251bc..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-error_reporting(E_ALL);
-
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ');
-$ids = array('num'=>'1234');
-
-$res = pg_select($db, $table_name, $ids) or print "Error\n";
-var_dump($res);
-echo pg_select($db, $table_name, $ids, PGSQL_DML_STRING)."\n";
-echo "Ok\n";
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/pg_update.inc b/ext/pgsql/tests/pg_update.inc
deleted file mode 100644 (file)
index 8fc8bb1..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-error_reporting(E_ALL);
-
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ');
-$ids = array('num'=>'1234');
-
-pg_update($db, $table_name, $fields, $ids) or print "Error in test 1\n";
-echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING)."\n";
-
-echo "Ok\n";
-
-?>
diff --git a/ext/pgsql/tests/result.inc b/ext/pgsql/tests/result.inc
deleted file mode 100644 (file)
index fb38938..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-error_reporting(E_ALL);
-
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-
-$sql = "SELECT * FROM $table_name";
-$result = pg_query($db, $sql) or die('Cannot qeury db');
-$rows = pg_num_rows($result);
-
-$rec = pg_fetch_object($result, 1);
-var_dump($rec);
-$rec = pg_fetch_array($result, 1);
-var_dump($rec);
-$rec = pg_fetch_row($result, 1);
-var_dump($rec);
-$rec = pg_fetch_assoc($result);
-var_dump($rec);
-var_dump(pg_result_seek($result, 0));
-
-echo "Ok\n";
-
-?>
\ No newline at end of file
diff --git a/ext/pgsql/tests/sync_query.inc b/ext/pgsql/tests/sync_query.inc
deleted file mode 100644 (file)
index 5a75b2c..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-include('config.inc');
-
-$db = pg_connect($conn_str);
-
-$result = pg_query($db, "SELECT * FROM ".$table_name.";");
-if (!($rows   = pg_num_rows($result)))
-{
-       echo "pg_num_row() error\n";
-}
-for ($i=0; $i < $rows; $i++) 
-{
-       pg_fetch_array($result, $i, PGSQL_NUM);
-}
-for ($i=0; $i < $rows; $i++) 
-{
-       pg_fetch_object($result, $i, PGSQL_ASSOC);
-}
-for ($i=0; $i < $rows; $i++) 
-{
-       pg_fetch_row($result, $i);
-}
-for ($i=0; $i < $rows; $i++) 
-{
-       pg_fetch_result($result, $i, 0);
-}
-
-pg_result_error($result);
-pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";"));
-pg_num_fields(pg_query($db, "SELECT * FROM ".$table_name.";"));
-pg_field_name($result, 0);
-pg_field_num($result, $field_name);
-pg_field_size($result, 0);
-pg_field_type($result, 0);
-pg_field_prtlen($result, 0);
-pg_field_is_null($result, 0);
-
-$result = pg_query($db, "INSERT INTO ".$table_name." VALUES (9999, 'ABC');");
-pg_last_oid($result);
-
-pg_free_result($result);
-pg_close($db);
-
-echo "OK";
-
-?>
\ No newline at end of file