summaryrefslogtreecommitdiff
path: root/ext/pgsql
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-02-03 22:52:20 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-02-03 22:52:20 +0100
commitf8d795820e780a6322e054c26c581570613c14f0 (patch)
tree99d3ae01ce564752807341c5743863b4c92513f8 /ext/pgsql
parentd2cb200e10ada6fa44c54a29292bb4665728fff0 (diff)
downloadphp-git-f8d795820e780a6322e054c26c581570613c14f0.tar.gz
Reindent phpt files
Diffstat (limited to 'ext/pgsql')
-rw-r--r--ext/pgsql/tests/01createdb.phpt14
-rw-r--r--ext/pgsql/tests/02connection.phpt24
-rw-r--r--ext/pgsql/tests/03sync_query.phpt46
-rw-r--r--ext/pgsql/tests/04async_query.phpt18
-rw-r--r--ext/pgsql/tests/05large_object.phpt2
-rw-r--r--ext/pgsql/tests/07optional.phpt6
-rw-r--r--ext/pgsql/tests/08escape.phpt72
-rw-r--r--ext/pgsql/tests/10pg_convert_json_array.phpt8
-rw-r--r--ext/pgsql/tests/15pg_delete.phpt4
-rw-r--r--ext/pgsql/tests/18pg_escape_bytea_before.phpt4
-rw-r--r--ext/pgsql/tests/18pg_escape_bytea_esc.phpt4
-rw-r--r--ext/pgsql/tests/18pg_escape_bytea_hex.phpt4
-rw-r--r--ext/pgsql/tests/22pg_fetch_object.phpt6
-rw-r--r--ext/pgsql/tests/23sync_query_params.phpt66
-rw-r--r--ext/pgsql/tests/24sync_query_prepared.phpt78
-rw-r--r--ext/pgsql/tests/25async_query_params.phpt88
-rw-r--r--ext/pgsql/tests/26async_query_prepared.phpt154
-rw-r--r--ext/pgsql/tests/29nb_async_connect.phpt36
-rw-r--r--ext/pgsql/tests/30nb_async_query_params.phpt24
-rw-r--r--ext/pgsql/tests/31nb_async_query_prepared.phpt38
-rw-r--r--ext/pgsql/tests/32nb_async_query.phpt26
-rw-r--r--ext/pgsql/tests/80_bug14383.phpt2
-rw-r--r--ext/pgsql/tests/80_bug24499.phpt26
-rw-r--r--ext/pgsql/tests/80_bug27597.phpt18
-rw-r--r--ext/pgsql/tests/80_bug32223.phpt4
-rw-r--r--ext/pgsql/tests/80_bug36625.phpt8
-rw-r--r--ext/pgsql/tests/80_bug39971.phpt2
-rw-r--r--ext/pgsql/tests/80_bug42783.phpt2
-rw-r--r--ext/pgsql/tests/bug71998.phpt74
-rw-r--r--ext/pgsql/tests/bug72028.phpt2
-rw-r--r--ext/pgsql/tests/bug77047.phpt6
-rw-r--r--ext/pgsql/tests/lcmess.inc18
-rw-r--r--ext/pgsql/tests/pg_insert_002.phpt2
-rw-r--r--ext/pgsql/tests/pg_update_001.phpt2
-rw-r--r--ext/pgsql/tests/skipif.inc26
35 files changed, 457 insertions, 457 deletions
diff --git a/ext/pgsql/tests/01createdb.phpt b/ext/pgsql/tests/01createdb.phpt
index 45062c3b49..2abd051c8b 100644
--- a/ext/pgsql/tests/01createdb.phpt
+++ b/ext/pgsql/tests/01createdb.phpt
@@ -11,22 +11,22 @@ include('config.inc');
$db = pg_connect($conn_str);
if (!($q = @pg_query($db, "SELECT * FROM ".$table_name)) || !@pg_num_rows($q))
{
- 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');");
- }
+ 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";
+ echo pg_last_error()."\n";
}
$v = pg_version();
if (version_compare($v['server'], '9.2', '>=') && (!($q = @pg_query($db, "SELECT * FROM ".$table_name_92)) || !@pg_num_rows($q)))
{
- pg_query($db,$table_def_92); // Create table here
+ pg_query($db,$table_def_92); // Create table here
}
else {
- echo pg_last_error()."\n";
+ echo pg_last_error()."\n";
}
// Create view here
diff --git a/ext/pgsql/tests/02connection.phpt b/ext/pgsql/tests/02connection.phpt
index 16a44e5dd9..9922bba98f 100644
--- a/ext/pgsql/tests/02connection.phpt
+++ b/ext/pgsql/tests/02connection.phpt
@@ -13,41 +13,41 @@ var_dump($db);
if (pg_connection_status($db) != PGSQL_CONNECTION_OK)
{
- echo "pg_connection_status() error\n";
+ echo "pg_connection_status() error\n";
}
if (!pg_connection_reset($db))
{
- echo "pg_connection_reset() error\n";
+ echo "pg_connection_reset() error\n";
}
if (pg_connection_busy($db))
{
- echo "pg_connection_busy() error\n";
+ echo "pg_connection_busy() error\n";
}
if (function_exists('pg_transaction_status')) {
- if (pg_transaction_status($db) != PGSQL_TRANSACTION_IDLE)
- {
- echo "pg_transaction_status() error\n";
- }
+ if (pg_transaction_status($db) != PGSQL_TRANSACTION_IDLE)
+ {
+ echo "pg_transaction_status() error\n";
+ }
}
if (false === pg_host($db))
{
- echo "pg_host() error\n";
+ echo "pg_host() error\n";
}
if (!pg_dbname($db))
{
- echo "pg_dbname() error\n";
+ echo "pg_dbname() error\n";
}
if (!pg_port($db))
{
- echo "pg_port() error\n";
+ echo "pg_port() error\n";
}
if (pg_tty($db))
{
- echo "pg_tty() error\n";
+ echo "pg_tty() error\n";
}
if (pg_options($db))
{
- echo "pg_options() error\n";
+ echo "pg_options() error\n";
}
pg_close($db);
diff --git a/ext/pgsql/tests/03sync_query.phpt b/ext/pgsql/tests/03sync_query.phpt
index eb8fae084d..1cd439bc20 100644
--- a/ext/pgsql/tests/03sync_query.phpt
+++ b/ext/pgsql/tests/03sync_query.phpt
@@ -12,45 +12,45 @@ $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";
+ echo "pg_num_row() error\n";
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_array($result, $i, PGSQL_NUM);
+ pg_fetch_array($result, $i, PGSQL_NUM);
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_object($result);
+ pg_fetch_object($result);
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_row($result, $i);
+ pg_fetch_row($result, $i);
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_result($result, $i, 0);
+ pg_fetch_result($result, $i, 0);
}
pg_result_error($result);
if (function_exists('pg_result_error_field')) {
- pg_result_error_field($result, PGSQL_DIAG_SEVERITY);
- pg_result_error_field($result, PGSQL_DIAG_SQLSTATE);
- pg_result_error_field($result, PGSQL_DIAG_MESSAGE_PRIMARY);
- pg_result_error_field($result, PGSQL_DIAG_MESSAGE_DETAIL);
- pg_result_error_field($result, PGSQL_DIAG_MESSAGE_HINT);
- pg_result_error_field($result, PGSQL_DIAG_STATEMENT_POSITION);
- if (defined('PGSQL_DIAG_INTERNAL_POSITION'))
- {
- pg_result_error_field($result, PGSQL_DIAG_INTERNAL_POSITION);
- }
- if (defined('PGSQL_DIAG_INTERNAL_QUERY'))
- {
- pg_result_error_field($result, PGSQL_DIAG_INTERNAL_QUERY);
- }
- pg_result_error_field($result, PGSQL_DIAG_CONTEXT);
- pg_result_error_field($result, PGSQL_DIAG_SOURCE_FILE);
- pg_result_error_field($result, PGSQL_DIAG_SOURCE_LINE);
- pg_result_error_field($result, PGSQL_DIAG_SOURCE_FUNCTION);
+ pg_result_error_field($result, PGSQL_DIAG_SEVERITY);
+ pg_result_error_field($result, PGSQL_DIAG_SQLSTATE);
+ pg_result_error_field($result, PGSQL_DIAG_MESSAGE_PRIMARY);
+ pg_result_error_field($result, PGSQL_DIAG_MESSAGE_DETAIL);
+ pg_result_error_field($result, PGSQL_DIAG_MESSAGE_HINT);
+ pg_result_error_field($result, PGSQL_DIAG_STATEMENT_POSITION);
+ if (defined('PGSQL_DIAG_INTERNAL_POSITION'))
+ {
+ pg_result_error_field($result, PGSQL_DIAG_INTERNAL_POSITION);
+ }
+ if (defined('PGSQL_DIAG_INTERNAL_QUERY'))
+ {
+ pg_result_error_field($result, PGSQL_DIAG_INTERNAL_QUERY);
+ }
+ pg_result_error_field($result, PGSQL_DIAG_CONTEXT);
+ pg_result_error_field($result, PGSQL_DIAG_SOURCE_FILE);
+ pg_result_error_field($result, PGSQL_DIAG_SOURCE_LINE);
+ pg_result_error_field($result, PGSQL_DIAG_SOURCE_FUNCTION);
}
pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";"));
pg_num_fields(pg_query($db, "SELECT * FROM ".$table_name.";"));
diff --git a/ext/pgsql/tests/04async_query.phpt b/ext/pgsql/tests/04async_query.phpt
index fe67382026..34d383ed68 100644
--- a/ext/pgsql/tests/04async_query.phpt
+++ b/ext/pgsql/tests/04async_query.phpt
@@ -10,35 +10,35 @@ include('config.inc');
$db = pg_connect($conn_str);
if (!pg_send_query($db, "SELECT * FROM ".$table_name.";")) {
- echo "pg_send_query() error\n";
+ 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";
+ echo "pg_connection_status() error\n";
}
if (!($result = pg_get_result($db)))
{
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
if (!($rows = pg_num_rows($result))) {
- echo "pg_num_rows() error\n";
+ echo "pg_num_rows() error\n";
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_array($result, $i, PGSQL_NUM);
+ pg_fetch_array($result, $i, PGSQL_NUM);
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_object($result);
+ pg_fetch_object($result);
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_row($result, $i);
+ pg_fetch_row($result, $i);
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_result($result, $i, 0);
+ pg_fetch_result($result, $i, 0);
}
pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";"));
@@ -52,7 +52,7 @@ pg_field_is_null($result, 0);
if (!pg_send_query($db, "INSERT INTO ".$table_name." VALUES (8888, 'GGG');"))
{
- echo "pg_send_query() error\n";
+ echo "pg_send_query() error\n";
}
pg_last_oid($result);
diff --git a/ext/pgsql/tests/05large_object.phpt b/ext/pgsql/tests/05large_object.phpt
index e091d6072a..df47d07404 100644
--- a/ext/pgsql/tests/05large_object.phpt
+++ b/ext/pgsql/tests/05large_object.phpt
@@ -63,7 +63,7 @@ pg_query($db, 'begin');
@unlink($path . 'php.gif.exported');
pg_lo_export($oid, $path . 'php.gif.exported', $db);
if (!file_exists($path . 'php.gif.exported')) {
- echo "Export failed\n";
+ echo "Export failed\n";
}
@unlink($path . 'php.gif.exported');
pg_query($db, 'commit');
diff --git a/ext/pgsql/tests/07optional.phpt b/ext/pgsql/tests/07optional.phpt
index 9fa6f16331..f633f81498 100644
--- a/ext/pgsql/tests/07optional.phpt
+++ b/ext/pgsql/tests/07optional.phpt
@@ -14,9 +14,9 @@ $enc = pg_client_encoding($db);
pg_set_client_encoding($db, $enc);
if (function_exists('pg_set_error_verbosity')) {
- pg_set_error_verbosity(PGSQL_ERRORS_TERSE);
- pg_set_error_verbosity(PGSQL_ERRORS_DEFAULT);
- pg_set_error_verbosity(PGSQL_ERRORS_VERBOSE);
+ pg_set_error_verbosity(PGSQL_ERRORS_TERSE);
+ pg_set_error_verbosity(PGSQL_ERRORS_DEFAULT);
+ pg_set_error_verbosity(PGSQL_ERRORS_VERBOSE);
}
echo "OK";
?>
diff --git a/ext/pgsql/tests/08escape.phpt b/ext/pgsql/tests/08escape.phpt
index 6b0d1899d4..6b510aef73 100644
--- a/ext/pgsql/tests/08escape.phpt
+++ b/ext/pgsql/tests/08escape.phpt
@@ -14,13 +14,13 @@ $expect = "ABC\\\\ABC\\'";
$expect2 = "ABC\\\\ABC\\\\''"; //the way escape string differs from PostgreSQL 9.0
$after = pg_escape_string($before);
if ($expect === $after || $expect2 === $after) {
- echo "pg_escape_string() is Ok\n";
+ 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);
+ echo "pg_escape_string() is NOT Ok\n";
+ var_dump($before);
+ var_dump($after);
+ var_dump($expect);
}
// pg_escape_bytea() test
@@ -28,13 +28,13 @@ $before = "ABC\\ABC";
$expect = "ABC\\\\\\\\ABC";
$after = pg_escape_bytea($before);
if ($expect === $after) {
- echo "pg_escape_bytea() is Ok\n";
+ 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);
+ echo "pg_escape_byte() is NOT Ok\n";
+ var_dump($before);
+ var_dump($after);
+ var_dump($expect);
}
// Test using database
@@ -49,23 +49,23 @@ pg_query($db, $sql);
// Retrieve binary from DB
for ($i = 0; $i < 2; $i++) {
- $sql = "SELECT bin::bytea FROM ".$table_name." WHERE num = 10000";
- $result = pg_query($db, $sql);
- $row = pg_fetch_array($result, 0, PGSQL_ASSOC);
+ $sql = "SELECT bin::bytea FROM ".$table_name." WHERE num = 10000";
+ $result = pg_query($db, $sql);
+ $row = pg_fetch_array($result, 0, PGSQL_ASSOC);
- if ($data === pg_unescape_bytea($row['bin'])) {
- echo "pg_escape_bytea() actually works with database\n";
- break;
- }
- elseif (!$i) {
- // Force bytea escaping and retry
- @pg_query($db, "SET bytea_output = 'escape'");
- }
- else {
- $result = pg_query($db, $sql);
- echo "pg_escape_bytea() is broken\n";
- break;
- }
+ if ($data === pg_unescape_bytea($row['bin'])) {
+ echo "pg_escape_bytea() actually works with database\n";
+ break;
+ }
+ elseif (!$i) {
+ // Force bytea escaping and retry
+ @pg_query($db, "SET bytea_output = 'escape'");
+ }
+ else {
+ $result = pg_query($db, $sql);
+ echo "pg_escape_bytea() is broken\n";
+ break;
+ }
}
// pg_escape_literal/pg_escape_identifier
@@ -73,26 +73,26 @@ $before = "ABC\\ABC\'";
$expect = " E'ABC\\\\ABC\\\\'''";
$after = pg_escape_literal($before);
if ($expect === $after) {
- echo "pg_escape_literal() is Ok\n";
+ echo "pg_escape_literal() is Ok\n";
}
else {
- echo "pg_escape_literal() is NOT Ok\n";
- var_dump($before);
- var_dump($after);
- var_dump($expect);
+ echo "pg_escape_literal() is NOT Ok\n";
+ var_dump($before);
+ var_dump($after);
+ var_dump($expect);
}
$before = "ABC\\ABC\'";
$expect = "\"ABC\ABC\'\"";
$after = pg_escape_identifier($before);
if ($expect === $after) {
- echo "pg_escape_identifier() is Ok\n";
+ echo "pg_escape_identifier() is Ok\n";
}
else {
- echo "pg_escape_identifier() is NOT Ok\n";
- var_dump($before);
- var_dump($after);
- var_dump($expect);
+ echo "pg_escape_identifier() is NOT Ok\n";
+ var_dump($before);
+ var_dump($after);
+ var_dump($expect);
}
?>
diff --git a/ext/pgsql/tests/10pg_convert_json_array.phpt b/ext/pgsql/tests/10pg_convert_json_array.phpt
index 960cfd6c99..46aec3ffbc 100644
--- a/ext/pgsql/tests/10pg_convert_json_array.phpt
+++ b/ext/pgsql/tests/10pg_convert_json_array.phpt
@@ -14,16 +14,16 @@ include 'config.inc';
$db = pg_connect($conn_str);
$fields = array(
- 'textary'=>'{"meeting", "lunch", "training", "presentation"}',
- 'jsn'=>'{"f1":1,"f2":"foo"}',
+ 'textary'=>'{"meeting", "lunch", "training", "presentation"}',
+ 'jsn'=>'{"f1":1,"f2":"foo"}',
);
$converted = pg_convert($db, $table_name_92, $fields);
var_dump($converted);
if (!pg_insert($db, $table_name_92, $fields)) {
- echo "Error\n";
+ echo "Error\n";
} else {
- echo "OK\n";
+ echo "OK\n";
}
?>
diff --git a/ext/pgsql/tests/15pg_delete.phpt b/ext/pgsql/tests/15pg_delete.phpt
index 3b9f7d803c..5afcf60253 100644
--- a/ext/pgsql/tests/15pg_delete.phpt
+++ b/ext/pgsql/tests/15pg_delete.phpt
@@ -15,10 +15,10 @@ $ids = array('num'=>'1234');
echo pg_delete($db, $table_name, $ids, PGSQL_DML_STRING)."\n";
echo pg_delete($db, $table_name, $ids, PGSQL_DML_STRING|PGSQL_DML_ESCAPE)."\n";
if (!pg_delete($db, $table_name, $ids)) {
- echo "Error\n";
+ echo "Error\n";
}
else {
- echo "Ok\n";
+ echo "Ok\n";
}
?>
--EXPECT--
diff --git a/ext/pgsql/tests/18pg_escape_bytea_before.phpt b/ext/pgsql/tests/18pg_escape_bytea_before.phpt
index ca2acd9ce7..8222eccde4 100644
--- a/ext/pgsql/tests/18pg_escape_bytea_before.phpt
+++ b/ext/pgsql/tests/18pg_escape_bytea_before.phpt
@@ -20,10 +20,10 @@ $rows = pg_fetch_all($result);
$unesc_image = pg_unescape_bytea($rows[0]['bin']);
if ($unesc_image !== $image) {
- echo "NG";
+ echo "NG";
}
else {
- echo "OK";
+ echo "OK";
}
?>
--EXPECT--
diff --git a/ext/pgsql/tests/18pg_escape_bytea_esc.phpt b/ext/pgsql/tests/18pg_escape_bytea_esc.phpt
index 263adad40c..0420c7eb75 100644
--- a/ext/pgsql/tests/18pg_escape_bytea_esc.phpt
+++ b/ext/pgsql/tests/18pg_escape_bytea_esc.phpt
@@ -20,10 +20,10 @@ $rows = pg_fetch_all($result);
$unesc_image = pg_unescape_bytea($rows[0]['bin']);
if ($unesc_image !== $image) {
- echo "NG";
+ echo "NG";
}
else {
- echo "OK";
+ echo "OK";
}
?>
--EXPECT--
diff --git a/ext/pgsql/tests/18pg_escape_bytea_hex.phpt b/ext/pgsql/tests/18pg_escape_bytea_hex.phpt
index 5af7bbebef..af2f3cf4d4 100644
--- a/ext/pgsql/tests/18pg_escape_bytea_hex.phpt
+++ b/ext/pgsql/tests/18pg_escape_bytea_hex.phpt
@@ -23,10 +23,10 @@ $rows = pg_fetch_all($result);
$unesc_image = pg_unescape_bytea($rows[0]['bin']);
if ($unesc_image !== $image) {
- echo "NG";
+ echo "NG";
}
else {
- echo "OK";
+ echo "OK";
}
?>
--EXPECT--
diff --git a/ext/pgsql/tests/22pg_fetch_object.phpt b/ext/pgsql/tests/22pg_fetch_object.phpt
index ebdf77568e..9f9319bcfe 100644
--- a/ext/pgsql/tests/22pg_fetch_object.phpt
+++ b/ext/pgsql/tests/22pg_fetch_object.phpt
@@ -9,9 +9,9 @@ error_reporting(E_ALL);
include 'config.inc';
class test_class {
- function __construct($arg1, $arg2) {
- echo __METHOD__ . "($arg1,$arg2)\n";
- }
+ function __construct($arg1, $arg2) {
+ echo __METHOD__ . "($arg1,$arg2)\n";
+ }
}
$db = pg_connect($conn_str);
diff --git a/ext/pgsql/tests/23sync_query_params.phpt b/ext/pgsql/tests/23sync_query_params.phpt
index a700ddca17..1406cec5bf 100644
--- a/ext/pgsql/tests/23sync_query_params.phpt
+++ b/ext/pgsql/tests/23sync_query_params.phpt
@@ -14,42 +14,42 @@ $db = pg_connect($conn_str);
$version = pg_version($db);
if ($version['protocol'] >= 3) {
- $result = pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
- 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);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_row($result, $i);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_result($result, $i, 0);
- }
+ $result = pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
+ 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);
+ }
+ 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_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
- pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
- 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);
+ pg_result_error($result);
+ pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+ pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+ 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_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));
- pg_last_oid($result);
+ $result = pg_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));
+ pg_last_oid($result);
- pg_free_result($result);
+ pg_free_result($result);
}
pg_close($db);
diff --git a/ext/pgsql/tests/24sync_query_prepared.phpt b/ext/pgsql/tests/24sync_query_prepared.phpt
index ca099eb43b..1ab7e095f4 100644
--- a/ext/pgsql/tests/24sync_query_prepared.phpt
+++ b/ext/pgsql/tests/24sync_query_prepared.phpt
@@ -14,48 +14,48 @@ $db = pg_connect($conn_str);
$version = pg_version($db);
if ($version['protocol'] >= 3) {
- $result = pg_prepare($db, "php_test", "SELECT * FROM ".$table_name." WHERE num > \$1;");
- pg_result_error($result);
- pg_free_result($result);
- $result = pg_execute($db, "php_test", array(100));
- 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);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_row($result, $i);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_result($result, $i, 0);
- }
+ $result = pg_prepare($db, "php_test", "SELECT * FROM ".$table_name." WHERE num > \$1;");
+ pg_result_error($result);
+ pg_free_result($result);
+ $result = pg_execute($db, "php_test", array(100));
+ 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);
+ }
+ 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_execute($db, "php_test", array(100)));
- pg_num_fields(pg_execute($db, "php_test", array(100)));
- 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);
+ pg_result_error($result);
+ pg_num_rows(pg_execute($db, "php_test", array(100)));
+ pg_num_fields(pg_execute($db, "php_test", array(100)));
+ 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_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);");
- pg_result_error($result);
- pg_free_result($result);
- $result = pg_execute($db, "php_test2", array(9999, "A'BC"));
- pg_last_oid($result);
+ $result = pg_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);");
+ pg_result_error($result);
+ pg_free_result($result);
+ $result = pg_execute($db, "php_test2", array(9999, "A'BC"));
+ pg_last_oid($result);
- pg_free_result($result);
+ pg_free_result($result);
}
pg_close($db);
diff --git a/ext/pgsql/tests/25async_query_params.phpt b/ext/pgsql/tests/25async_query_params.phpt
index ae1a1630ef..87b5e0dbb1 100644
--- a/ext/pgsql/tests/25async_query_params.phpt
+++ b/ext/pgsql/tests/25async_query_params.phpt
@@ -14,53 +14,53 @@ $db = pg_connect($conn_str);
$version = pg_version($db);
if ($version['protocol'] >= 3) {
- if (!pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))) {
- echo "pg_send_query_params() 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);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_row($result, $i);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_result($result, $i, 0);
- }
+ if (!pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))) {
+ echo "pg_send_query_params() 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);
+ }
+ 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_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
- pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
- 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);
+ pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+ pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+ 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_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC")))
- {
- echo "pg_send_query_params() error\n";
- }
+ if (!pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC")))
+ {
+ echo "pg_send_query_params() error\n";
+ }
- pg_last_oid($result);
- pg_free_result($result);
+ pg_last_oid($result);
+ pg_free_result($result);
}
pg_close($db);
diff --git a/ext/pgsql/tests/26async_query_prepared.phpt b/ext/pgsql/tests/26async_query_prepared.phpt
index 33ca7c7bfa..6eacb4e3ee 100644
--- a/ext/pgsql/tests/26async_query_prepared.phpt
+++ b/ext/pgsql/tests/26async_query_prepared.phpt
@@ -14,89 +14,89 @@ $db = pg_connect($conn_str);
$version = pg_version($db);
if ($version['protocol'] >= 3) {
- if (!pg_send_prepare($db, 'php_test', "SELECT * FROM ".$table_name." WHERE num > \$1;")) {
- echo "pg_send_prepare() 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";
- }
- pg_free_result($result);
+ if (!pg_send_prepare($db, 'php_test', "SELECT * FROM ".$table_name." WHERE num > \$1;")) {
+ echo "pg_send_prepare() 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";
+ }
+ pg_free_result($result);
- if (!pg_send_execute($db, 'php_test', array(100))) {
- echo "pg_send_execute() 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 (!pg_send_execute($db, 'php_test', array(100))) {
+ echo "pg_send_execute() 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);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_row($result, $i);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_result($result, $i, 0);
- }
+ 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);
+ }
+ 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_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
- pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
- 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);
+ pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+ pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+ 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_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);"))
- {
- echo "pg_send_prepare() 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";
- }
- pg_free_result($result);
+ if (!pg_send_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);"))
+ {
+ echo "pg_send_prepare() 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";
+ }
+ pg_free_result($result);
- if (!pg_send_execute($db, "php_test2", array(9999, "A'BC")))
- {
- echo "pg_send_execute() 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 (!pg_send_execute($db, "php_test2", array(9999, "A'BC")))
+ {
+ echo "pg_send_execute() 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";
+ }
- pg_last_oid($result);
- pg_free_result($result);
+ pg_last_oid($result);
+ pg_free_result($result);
}
pg_close($db);
diff --git a/ext/pgsql/tests/29nb_async_connect.phpt b/ext/pgsql/tests/29nb_async_connect.phpt
index a9b17ebc3a..d98b34da47 100644
--- a/ext/pgsql/tests/29nb_async_connect.phpt
+++ b/ext/pgsql/tests/29nb_async_connect.phpt
@@ -11,30 +11,30 @@ include('config.inc');
include('nonblocking.inc');
if (!$db = pg_connect($conn_str, PGSQL_CONNECT_ASYNC)) {
- die("pg_connect() error");
+ die("pg_connect() error");
} elseif (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
- die("pg_connect() error");
+ die("pg_connect() error");
} elseif ($db_socket = pg_socket($db)) {
- stream_set_blocking($db_socket, FALSE);
+ stream_set_blocking($db_socket, FALSE);
} else {
- die("pg_socket() error");
+ die("pg_socket() error");
}
while (TRUE) {
- switch ($status = pg_connect_poll($db)) {
- case PGSQL_POLLING_READING:
- nb_is_readable($db_socket);
- break;
- case PGSQL_POLLING_WRITING:
- nb_is_writable($db_socket);
- break;
- case PGSQL_POLLING_FAILED:
- die("async connection failed");
- case PGSQL_POLLING_OK:
- break 2;
- default:
- die("unknown poll status");
- }
+ switch ($status = pg_connect_poll($db)) {
+ case PGSQL_POLLING_READING:
+ nb_is_readable($db_socket);
+ break;
+ case PGSQL_POLLING_WRITING:
+ nb_is_writable($db_socket);
+ break;
+ case PGSQL_POLLING_FAILED:
+ die("async connection failed");
+ case PGSQL_POLLING_OK:
+ break 2;
+ default:
+ die("unknown poll status");
+ }
}
assert(pg_connection_status($db) === PGSQL_CONNECTION_OK);
echo "OK";
diff --git a/ext/pgsql/tests/30nb_async_query_params.phpt b/ext/pgsql/tests/30nb_async_query_params.phpt
index 1c8a1eed8f..612327a9c4 100644
--- a/ext/pgsql/tests/30nb_async_query_params.phpt
+++ b/ext/pgsql/tests/30nb_async_query_params.phpt
@@ -15,8 +15,8 @@ $db = pg_connect($conn_str);
$version = pg_version($db);
if ($version['protocol'] < 3) {
- echo "OK";
- exit(0);
+ echo "OK";
+ exit(0);
}
$db_socket = pg_socket($db);
@@ -24,30 +24,30 @@ stream_set_blocking($db_socket, false);
$sent = pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
if ($sent === FALSE) {
- echo "pg_send_query_params() error\n";
+ echo "pg_send_query_params() error\n";
} elseif ($sent === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
nb_consume($db, $db_socket);
if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
if (!($rows = pg_num_rows($result))) {
- echo "pg_num_rows() error\n";
+ echo "pg_num_rows() error\n";
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_array($result, $i, PGSQL_NUM);
+ pg_fetch_array($result, $i, PGSQL_NUM);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_object($result);
+ pg_fetch_object($result);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_row($result, $i);
+ pg_fetch_row($result, $i);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_result($result, $i, 0);
+ pg_fetch_result($result, $i, 0);
}
pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
@@ -62,9 +62,9 @@ pg_field_is_null($result, 0);
$sent = pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));
if ($sent === FALSE) {
- echo "pg_send_query_params() error\n";
+ echo "pg_send_query_params() error\n";
} elseif ($sent === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
pg_last_oid($result);
diff --git a/ext/pgsql/tests/31nb_async_query_prepared.phpt b/ext/pgsql/tests/31nb_async_query_prepared.phpt
index f485e596f9..476f21bc51 100644
--- a/ext/pgsql/tests/31nb_async_query_prepared.phpt
+++ b/ext/pgsql/tests/31nb_async_query_prepared.phpt
@@ -15,8 +15,8 @@ $db = pg_connect($conn_str);
$version = pg_version($db);
if ($version['protocol'] < 3) {
- echo "OK";
- exit(0);
+ echo "OK";
+ exit(0);
}
$db_socket = pg_socket($db);
@@ -24,45 +24,45 @@ stream_set_blocking($db_socket, false);
$nb_send = pg_send_prepare($db, 'php_test', "SELECT * FROM ".$table_name." WHERE num > \$1;");
if ($nb_send === FALSE) {
- echo "pg_send_prepare() error\n";
+ echo "pg_send_prepare() error\n";
} elseif ($nb_send === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
nb_consume($db, $db_socket);
if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
pg_free_result($result);
$nb_send = pg_send_execute($db, 'php_test', array(100));
if ($nb_send === FALSE) {
- echo "pg_send_execute() error\n";
+ echo "pg_send_execute() error\n";
} elseif ($nb_send === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
nb_consume($db, $db_socket);
if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
if (!($rows = pg_num_rows($result))) {
- echo "pg_num_rows() error\n";
+ echo "pg_num_rows() error\n";
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_array($result, $i, PGSQL_NUM);
+ pg_fetch_array($result, $i, PGSQL_NUM);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_object($result);
+ pg_fetch_object($result);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_row($result, $i);
+ pg_fetch_row($result, $i);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_result($result, $i, 0);
+ pg_fetch_result($result, $i, 0);
}
pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
@@ -76,29 +76,29 @@ pg_field_is_null($result, 0);
$nb_send = pg_send_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);");
if ($nb_send === FALSE) {
- echo "pg_send_prepare() error\n";
+ echo "pg_send_prepare() error\n";
} elseif ($nb_send === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
nb_consume($db, $db_socket);
if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
pg_free_result($result);
$nb_send = pg_send_execute($db, "php_test2", array(9999, "A'BC"));
if ($nb_send === FALSE) {
- echo "pg_send_execute() error\n";
+ echo "pg_send_execute() error\n";
} elseif ($nb_send === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
nb_consume($db, $db_socket);
if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
pg_last_oid($result);
diff --git a/ext/pgsql/tests/32nb_async_query.phpt b/ext/pgsql/tests/32nb_async_query.phpt
index 8ef1591db5..a90f9799a3 100644
--- a/ext/pgsql/tests/32nb_async_query.phpt
+++ b/ext/pgsql/tests/32nb_async_query.phpt
@@ -15,8 +15,8 @@ $db = pg_connect($conn_str);
$version = pg_version($db);
if ($version['protocol'] < 3) {
- echo "OK";
- exit(0);
+ echo "OK";
+ exit(0);
}
$db_socket = pg_socket($db);
@@ -24,31 +24,31 @@ stream_set_blocking($db_socket, false);
$nb_send = pg_send_query($db, "SELECT * FROM ".$table_name.";");
if ($nb_send === FALSE) {
- echo "pg_send_query() error\n";
+ echo "pg_send_query() error\n";
} elseif ($nb_send === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
nb_consume($db, $db_socket);
if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
if (!($rows = pg_num_rows($result))) {
- echo "pg_num_rows() error\n";
+ echo "pg_num_rows() error\n";
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_array($result, $i, PGSQL_NUM);
+ pg_fetch_array($result, $i, PGSQL_NUM);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_object($result);
+ pg_fetch_object($result);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_row($result, $i);
+ pg_fetch_row($result, $i);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_result($result, $i, 0);
+ pg_fetch_result($result, $i, 0);
}
pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";"));
@@ -62,15 +62,15 @@ pg_field_is_null($result, 0);
$nb_send = pg_send_query($db, "INSERT INTO ".$table_name." VALUES (8888, 'GGG');");
if ($nb_send === FALSE) {
- echo "pg_send_query() error\n";
+ echo "pg_send_query() error\n";
} elseif ($nb_send === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
nb_consume($db, $db_socket);
if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
pg_last_oid($result);
diff --git a/ext/pgsql/tests/80_bug14383.phpt b/ext/pgsql/tests/80_bug14383.phpt
index 1331f146cc..e9c6093888 100644
--- a/ext/pgsql/tests/80_bug14383.phpt
+++ b/ext/pgsql/tests/80_bug14383.phpt
@@ -11,7 +11,7 @@ require_once('config.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
- die ("Could not connect to the server");
+ die ("Could not connect to the server");
}
pg_close($dbh);
diff --git a/ext/pgsql/tests/80_bug24499.phpt b/ext/pgsql/tests/80_bug24499.phpt
index a9773bdafe..1ba8accade 100644
--- a/ext/pgsql/tests/80_bug24499.phpt
+++ b/ext/pgsql/tests/80_bug24499.phpt
@@ -11,7 +11,7 @@ require_once('config.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
- die ("Could not connect to the server");
+ die ("Could not connect to the server");
}
@pg_query("DROP SEQUENCE id_id_seq");
@@ -19,24 +19,24 @@ if (!$dbh) {
pg_query("CREATE TABLE id (id SERIAL, t INT)");
for ($i=0; $i<4; $i++) {
- pg_query("INSERT INTO id (t) VALUES ($i)");
+ pg_query("INSERT INTO id (t) VALUES ($i)");
}
class Id
{
- public $id;
+ public $id;
- public function getId()
- {
- global $dbh;
+ public function getId()
+ {
+ global $dbh;
- $q = pg_query($dbh, "SELECT id FROM id");
- print_r(pg_fetch_array($q));
- print_r(pg_fetch_array($q));
- $id = pg_fetch_object($q);
- var_dump($id);
- return $id->id;
- }
+ $q = pg_query($dbh, "SELECT id FROM id");
+ print_r(pg_fetch_array($q));
+ print_r(pg_fetch_array($q));
+ $id = pg_fetch_object($q);
+ var_dump($id);
+ return $id->id;
+ }
}
$id = new Id();
diff --git a/ext/pgsql/tests/80_bug27597.phpt b/ext/pgsql/tests/80_bug27597.phpt
index 5e28258570..92f0d81800 100644
--- a/ext/pgsql/tests/80_bug27597.phpt
+++ b/ext/pgsql/tests/80_bug27597.phpt
@@ -11,29 +11,29 @@ require_once(__DIR__ . '/config.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
- die ("Could not connect to the server");
+ die ("Could not connect to the server");
}
@pg_query("DROP TABLE id");
pg_query("CREATE TABLE id (id INT)");
for ($i=0; $i<4; $i++) {
- pg_query("INSERT INTO id (id) VALUES ($i)");
+ pg_query("INSERT INTO id (id) VALUES ($i)");
}
function xi_fetch_array($res, $type = PGSQL_ASSOC) {
- $a = pg_fetch_array($res, NULL, $type) ;
- return $a ;
+ $a = pg_fetch_array($res, NULL, $type) ;
+ return $a ;
}
$res = pg_query("SELECT * FROM id");
$i = 0; // endless-loop protection
while($row = xi_fetch_array($res)) {
- print_r($row);
- if ($i++ > 4) {
- echo "ENDLESS-LOOP";
- exit(1);
- }
+ print_r($row);
+ if ($i++ > 4) {
+ echo "ENDLESS-LOOP";
+ exit(1);
+ }
}
pg_close($dbh);
diff --git a/ext/pgsql/tests/80_bug32223.phpt b/ext/pgsql/tests/80_bug32223.phpt
index 36dd3a803f..08c8903dbf 100644
--- a/ext/pgsql/tests/80_bug32223.phpt
+++ b/ext/pgsql/tests/80_bug32223.phpt
@@ -25,7 +25,7 @@ require_once('lcmess.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
- die ("Could not connect to the server");
+ die ("Could not connect to the server");
}
_set_lc_messages();
@@ -46,7 +46,7 @@ var_dump($row);
pg_free_result($res);
if ($row[0] == 'f')
{
- var_dump(pg_last_notice($dbh));
+ var_dump(pg_last_notice($dbh));
}
pg_close($dbh);
diff --git a/ext/pgsql/tests/80_bug36625.phpt b/ext/pgsql/tests/80_bug36625.phpt
index 5d83024681..63908f3b7a 100644
--- a/ext/pgsql/tests/80_bug36625.phpt
+++ b/ext/pgsql/tests/80_bug36625.phpt
@@ -11,7 +11,7 @@ require_once('config.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
- die ('Could not connect to the server');
+ die ('Could not connect to the server');
}
$tracefile = __DIR__ . '/trace.tmp';
@@ -27,9 +27,9 @@ pg_close($dbh);
$found = 0;
function search_trace_file($line)
{
- if (strpos($line, '"select 1"') !== false || strpos($line, "'select 1'") !== false) {
- $GLOBALS['found']++;
- }
+ if (strpos($line, '"select 1"') !== false || strpos($line, "'select 1'") !== false) {
+ $GLOBALS['found']++;
+ }
}
$trace = file($tracefile);
diff --git a/ext/pgsql/tests/80_bug39971.phpt b/ext/pgsql/tests/80_bug39971.phpt
index 14c7fbd547..4fd065adf7 100644
--- a/ext/pgsql/tests/80_bug39971.phpt
+++ b/ext/pgsql/tests/80_bug39971.phpt
@@ -11,7 +11,7 @@ require_once('config.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
- die ("Could not connect to the server");
+ die ("Could not connect to the server");
}
pg_query("CREATE TABLE php_test (id SERIAL, tm timestamp NOT NULL)");
diff --git a/ext/pgsql/tests/80_bug42783.phpt b/ext/pgsql/tests/80_bug42783.phpt
index c375aa0d66..49119891e0 100644
--- a/ext/pgsql/tests/80_bug42783.phpt
+++ b/ext/pgsql/tests/80_bug42783.phpt
@@ -11,7 +11,7 @@ require_once('config.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
- die ("Could not connect to the server");
+ die ("Could not connect to the server");
}
pg_query("CREATE TABLE php_test (id SERIAL PRIMARY KEY, time TIMESTAMP NOT NULL DEFAULT now())");
diff --git a/ext/pgsql/tests/bug71998.phpt b/ext/pgsql/tests/bug71998.phpt
index 01d295e3e8..116135ab51 100644
--- a/ext/pgsql/tests/bug71998.phpt
+++ b/ext/pgsql/tests/bug71998.phpt
@@ -14,61 +14,61 @@ $db = pg_connect($conn_str);
pg_query("CREATE TABLE tmp_statistics (id integer NOT NULL, remote_addr inet);");
$ips = array(
- /* IPv4*/
- "127.0.0.1",
- "10.0.0.1",
- "192.168.1.1",
- "0.0.0.0",
- "255.255.255.255",
- "192.168.1.35/24",
+ /* IPv4*/
+ "127.0.0.1",
+ "10.0.0.1",
+ "192.168.1.1",
+ "0.0.0.0",
+ "255.255.255.255",
+ "192.168.1.35/24",
- /* IPv6 */
- "::1",
- "::10.2.3.4",
- "::ffff:10.4.3.2",
- "1:2:3:4:5:6:7:8",
- "::ffff:10.0.0.1",
- "::ffff:1.2.3.4",
- "::ffff:0.0.0.0",
- "1:2:3:4:5:6:77:88",
- "::ffff:255.255.255.255",
- "fe08::7:8",
- "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
- "::5:aef1:ffff/128",
- "2001:4f8:3:ba::/112",
+ /* IPv6 */
+ "::1",
+ "::10.2.3.4",
+ "::ffff:10.4.3.2",
+ "1:2:3:4:5:6:7:8",
+ "::ffff:10.0.0.1",
+ "::ffff:1.2.3.4",
+ "::ffff:0.0.0.0",
+ "1:2:3:4:5:6:77:88",
+ "::ffff:255.255.255.255",
+ "fe08::7:8",
+ "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
+ "::5:aef1:ffff/128",
+ "2001:4f8:3:ba::/112",
);
$bad = array(
- /* bad */
- "256.257.258.259",
- "fe08::7:8interface",
- "schnitzel",
- "10002.3.4",
- "1.2.3.4.5",
- "256.0.0.0",
- "260.0.0.0",
+ /* bad */
+ "256.257.258.259",
+ "fe08::7:8interface",
+ "schnitzel",
+ "10002.3.4",
+ "1.2.3.4.5",
+ "256.0.0.0",
+ "260.0.0.0",
);
$ips = array_merge($ips, $bad);
$i = 0;
$errors = 0;
foreach ($ips as $ip) {
- $data = array("id" => ++$i, "remote_addr" => $ip);
- $r = @pg_insert($db, 'tmp_statistics', $data);
+ $data = array("id" => ++$i, "remote_addr" => $ip);
+ $r = @pg_insert($db, 'tmp_statistics', $data);
- if (!$r && in_array($ip, $bad)) {
- $errors++;
- //echo pg_last_error($db);
- }
+ if (!$r && in_array($ip, $bad)) {
+ $errors++;
+ //echo pg_last_error($db);
+ }
- //pg_query($db, "INSERT INTO tmp_statistics (id, remote_addr) VALUES (2, '127.0.0.1')"); // OK, record inserted
+ //pg_query($db, "INSERT INTO tmp_statistics (id, remote_addr) VALUES (2, '127.0.0.1')"); // OK, record inserted
}
$r = pg_query($db, "SELECT * FROM tmp_statistics");
while (false != ($row = pg_fetch_row($r))) {
- var_dump($row);
+ var_dump($row);
}
echo $errors, " errors caught\n";
diff --git a/ext/pgsql/tests/bug72028.phpt b/ext/pgsql/tests/bug72028.phpt
index a16f8e72f7..7073ca7d03 100644
--- a/ext/pgsql/tests/bug72028.phpt
+++ b/ext/pgsql/tests/bug72028.phpt
@@ -29,7 +29,7 @@ $result = pg_query_params($conn, $sql, $params2);
$r = pg_query("SELECT * FROM $table");
while (false !== ($i = pg_fetch_assoc($r))) {
- var_dump($i);
+ var_dump($i);
}
pg_query("DROP TABLE $table");
diff --git a/ext/pgsql/tests/bug77047.phpt b/ext/pgsql/tests/bug77047.phpt
index 2cbc4c3dda..222a5398b6 100644
--- a/ext/pgsql/tests/bug77047.phpt
+++ b/ext/pgsql/tests/bug77047.phpt
@@ -14,8 +14,8 @@ $db = pg_connect($conn_str);
pg_query($db, "DROP TABLE IF EXISTS bug77047");
pg_query($db, "CREATE TABLE bug77047 (
- t TIME WITHOUT TIME ZONE
- )");
+ t TIME WITHOUT TIME ZONE
+ )");
pg_insert($db, "bug77047", array("t" => "13:31"));
pg_insert($db, "bug77047", array("t" => "13:31:13"));
@@ -26,7 +26,7 @@ pg_insert($db, "bug77047", array("t" => ""));
$res = pg_query($db, "SELECT t FROM bug77047");
while (false !== ($row = pg_fetch_row($res))) {
- var_dump(array_pop($row));
+ var_dump(array_pop($row));
}
?>
diff --git a/ext/pgsql/tests/lcmess.inc b/ext/pgsql/tests/lcmess.inc
index 6e0ac25b11..32ab0e36f5 100644
--- a/ext/pgsql/tests/lcmess.inc
+++ b/ext/pgsql/tests/lcmess.inc
@@ -2,20 +2,20 @@
function _skip_lc_messages($lc_messages = 'C')
{
- if (!_set_lc_messages($lc_messages)) {
- die("skip Cannot set LC_MESSAGES to '{$lc_messages}'\n");
- }
+ if (!_set_lc_messages($lc_messages)) {
+ die("skip Cannot set LC_MESSAGES to '{$lc_messages}'\n");
+ }
}
function _set_lc_messages($lc_messages = 'C')
{
- if (pg_result(pg_query("SHOW LC_MESSAGES"), 0, 0) != $lc_messages) {
- if (!@pg_exec("SET LC_MESSAGES='{$lc_messages}'")) {
- return false;
- }
- }
+ if (pg_result(pg_query("SHOW LC_MESSAGES"), 0, 0) != $lc_messages) {
+ if (!@pg_exec("SET LC_MESSAGES='{$lc_messages}'")) {
+ return false;
+ }
+ }
- return true;
+ return true;
}
?>
diff --git a/ext/pgsql/tests/pg_insert_002.phpt b/ext/pgsql/tests/pg_insert_002.phpt
index 0dcee55b8f..bb84a00d0d 100644
--- a/ext/pgsql/tests/pg_insert_002.phpt
+++ b/ext/pgsql/tests/pg_insert_002.phpt
@@ -10,7 +10,7 @@ include('config.inc');
$conn = pg_connect($conn_str);
foreach (array('', '.', '..') as $table) {
- var_dump(pg_insert($conn, $table, array('id' => 1, 'id2' => 1)));
+ var_dump(pg_insert($conn, $table, array('id' => 1, 'id2' => 1)));
}
?>
Done
diff --git a/ext/pgsql/tests/pg_update_001.phpt b/ext/pgsql/tests/pg_update_001.phpt
index 85a86f3d23..7ef66c2652 100644
--- a/ext/pgsql/tests/pg_update_001.phpt
+++ b/ext/pgsql/tests/pg_update_001.phpt
@@ -26,7 +26,7 @@ var_dump(pg_update($conn, 'phptests.foo', array('id' => 100), array('id2' => 2),
$rs = pg_query('SELECT * FROM foo UNION SELECT * FROM phptests.foo ORDER BY id');
while ($row = pg_fetch_assoc($rs)) {
- var_dump($row);
+ var_dump($row);
}
pg_query('DROP TABLE foo');
diff --git a/ext/pgsql/tests/skipif.inc b/ext/pgsql/tests/skipif.inc
index e24847445c..38c2888afa 100644
--- a/ext/pgsql/tests/skipif.inc
+++ b/ext/pgsql/tests/skipif.inc
@@ -19,27 +19,27 @@ if (!is_resource($conn)) {
function skip_server_version($version, $op = '<')
{
- $pg = pg_parameter_status('server_version');
- if (version_compare($pg, $version, $op)) {
- die("skip Server version {$pg} is {$op} {$version}\n");
- }
- return $pg;
+ $pg = pg_parameter_status('server_version');
+ if (version_compare($pg, $version, $op)) {
+ die("skip Server version {$pg} is {$op} {$version}\n");
+ }
+ return $pg;
}
function skip_bytea_not_hex()
{
- $out = pg_escape_bytea("\xFF");
- if (strpos($out, '377') !== false) {
- die("skip libpq or backend < 9.0\n");
- }
+ $out = pg_escape_bytea("\xFF");
+ if (strpos($out, '377') !== false) {
+ die("skip libpq or backend < 9.0\n");
+ }
}
function skip_bytea_not_escape()
{
- $out = pg_escape_bytea("\xFF");
- if (strpos($out, '377') === false) {
- die("skip libpq or backend >= 9.0\n");
- }
+ $out = pg_escape_bytea("\xFF");
+ if (strpos($out, '377') === false) {
+ die("skip libpq or backend >= 9.0\n");
+ }
}
?>