Skip to content

Commit a37c41e

Browse files
committed
Stubs, test case, and indentation
1 parent 296866f commit a37c41e

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

ext/pgsql/pgsql.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2742,13 +2742,13 @@ PHP_FUNCTION(pg_lo_import)
27422742
RETURN_FALSE;
27432743
}
27442744

2745-
returned_oid = lo_import_with_oid(pgsql, file_in, wanted_oid);
2745+
returned_oid = lo_import_with_oid(pgsql, file_in, wanted_oid);
27462746

2747-
if (returned_oid == InvalidOid) {
2748-
RETURN_FALSE;
2749-
}
2747+
if (returned_oid == InvalidOid) {
2748+
RETURN_FALSE;
2749+
}
27502750

2751-
PGSQL_RETURN_OID(returned_oid);
2751+
PGSQL_RETURN_OID(returned_oid);
27522752
}
27532753

27542754
returned_oid = lo_import(pgsql, file_in);

ext/pgsql/pgsql.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,4 +488,4 @@ function pg_update($connection, string $table_name, array $values, array $ids, i
488488
function pg_delete($connection, string $table_name, array $ids, int $options = 0): string|bool {}
489489

490490
/** @param resource $connection */
491-
function pg_select($connection, string $table_name, array $ids, int $options = 0): array|string|false {}
491+
function pg_select($connection, string $table_name, array $ids, int $options = 0, int $result_type = PGSQL_ASSOC): array|string|false {}

ext/pgsql/pgsql_arginfo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 8af10097e015c7bb5025e54ed5054911afac008f */
2+
* Stub hash: 90dd576049fe13617343fe689000b94b20f47655 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_connect, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0)
@@ -437,6 +437,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_select, 0, 3, MAY_BE_ARRAY|MA
437437
ZEND_ARG_TYPE_INFO(0, table_name, IS_STRING, 0)
438438
ZEND_ARG_TYPE_INFO(0, ids, IS_ARRAY, 0)
439439
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "0")
440+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, result_type, IS_LONG, 0, "PGSQL_ASSOC")
440441
ZEND_END_ARG_INFO()
441442

442443

ext/pgsql/tests/pg_select_001.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ var_dump(pg_select($conn, 'phptests.bar', array('id' => 1)));
3131
/* Existent column */
3232
var_dump(pg_select($conn, 'phptests.bar', array('id4' => 4)));
3333

34+
/* Use a different result type */
35+
var_dump(pg_select($conn, 'phptests.bar', array('id4' => 4), 0, PGSQL_NUM));
3436

3537
pg_query('DROP TABLE phptests.foo');
3638
pg_query('DROP TABLE phptests.bar');
@@ -61,3 +63,12 @@ array(1) {
6163
string(1) "5"
6264
}
6365
}
66+
array(1) {
67+
[0]=>
68+
array(2) {
69+
[0]=>
70+
string(1) "4"
71+
[1]=>
72+
string(1) "5"
73+
}
74+
}

0 commit comments

Comments
 (0)