Skip to content

Commit 4dd8fec

Browse files
committed
Add stubs for PDO PGSql extension methods
1 parent 1afcced commit 4dd8fec

File tree

4 files changed

+116
-25
lines changed

4 files changed

+116
-25
lines changed

ext/pdo_pgsql/pgsql_driver.c

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "php_pdo_pgsql.h"
3434
#include "php_pdo_pgsql_int.h"
3535
#include "zend_exceptions.h"
36+
#include "pgsql_driver_arginfo.h"
3637

3738
static char * _pdo_pgsql_trim_message(const char *message, int persistent)
3839
{
@@ -545,7 +546,7 @@ static int pgsql_handle_rollback(pdo_dbh_t *dbh)
545546
}
546547

547548
/* {{{ Returns true if the copy worked fine or false if error */
548-
static PHP_METHOD(PDO, pgsqlCopyFromArray)
549+
PHP_METHOD(PDO_PGSql_Ext, pgsqlCopyFromArray)
549550
{
550551
pdo_dbh_t *dbh;
551552
pdo_pgsql_db_handle *H;
@@ -658,7 +659,7 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray)
658659
/* }}} */
659660

660661
/* {{{ Returns true if the copy worked fine or false if error */
661-
static PHP_METHOD(PDO, pgsqlCopyFromFile)
662+
PHP_METHOD(PDO_PGSql_Ext, pgsqlCopyFromFile)
662663
{
663664
pdo_dbh_t *dbh;
664665
pdo_pgsql_db_handle *H;
@@ -756,7 +757,7 @@ static PHP_METHOD(PDO, pgsqlCopyFromFile)
756757

757758

758759
/* {{{ Returns true if the copy worked fine or false if error */
759-
static PHP_METHOD(PDO, pgsqlCopyToFile)
760+
PHP_METHOD(PDO_PGSql_Ext, pgsqlCopyToFile)
760761
{
761762
pdo_dbh_t *dbh;
762763
pdo_pgsql_db_handle *H;
@@ -850,7 +851,7 @@ static PHP_METHOD(PDO, pgsqlCopyToFile)
850851
/* }}} */
851852

852853
/* {{{ Returns true if the copy worked fine or false if error */
853-
static PHP_METHOD(PDO, pgsqlCopyToArray)
854+
PHP_METHOD(PDO_PGSql_Ext, pgsqlCopyToArray)
854855
{
855856
pdo_dbh_t *dbh;
856857
pdo_pgsql_db_handle *H;
@@ -926,7 +927,7 @@ static PHP_METHOD(PDO, pgsqlCopyToArray)
926927

927928

928929
/* {{{ Creates a new large object, returning its identifier. Must be called inside a transaction. */
929-
static PHP_METHOD(PDO, pgsqlLOBCreate)
930+
PHP_METHOD(PDO_PGSql_Ext, pgsqlLOBCreate)
930931
{
931932
pdo_dbh_t *dbh;
932933
pdo_pgsql_db_handle *H;
@@ -954,7 +955,7 @@ static PHP_METHOD(PDO, pgsqlLOBCreate)
954955
/* }}} */
955956

956957
/* {{{ Opens an existing large object stream. Must be called inside a transaction. */
957-
static PHP_METHOD(PDO, pgsqlLOBOpen)
958+
PHP_METHOD(PDO_PGSql_Ext, pgsqlLOBOpen)
958959
{
959960
pdo_dbh_t *dbh;
960961
pdo_pgsql_db_handle *H;
@@ -1005,7 +1006,7 @@ static PHP_METHOD(PDO, pgsqlLOBOpen)
10051006
/* }}} */
10061007

10071008
/* {{{ Deletes the large object identified by oid. Must be called inside a transaction. */
1008-
static PHP_METHOD(PDO, pgsqlLOBUnlink)
1009+
PHP_METHOD(PDO_PGSql_Ext, pgsqlLOBUnlink)
10091010
{
10101011
pdo_dbh_t *dbh;
10111012
pdo_pgsql_db_handle *H;
@@ -1040,7 +1041,7 @@ static PHP_METHOD(PDO, pgsqlLOBUnlink)
10401041
/* }}} */
10411042

10421043
/* {{{ Get asynchronous notification */
1043-
static PHP_METHOD(PDO, pgsqlGetNotify)
1044+
PHP_METHOD(PDO_PGSql_Ext, pgsqlGetNotify)
10441045
{
10451046
pdo_dbh_t *dbh;
10461047
pdo_pgsql_db_handle *H;
@@ -1120,7 +1121,7 @@ static PHP_METHOD(PDO, pgsqlGetNotify)
11201121
/* }}} */
11211122

11221123
/* {{{ Get backend(server) pid */
1123-
static PHP_METHOD(PDO, pgsqlGetPid)
1124+
PHP_METHOD(PDO_PGSql_Ext, pgsqlGetPid)
11241125
{
11251126
pdo_dbh_t *dbh;
11261127
pdo_pgsql_db_handle *H;
@@ -1136,25 +1137,11 @@ static PHP_METHOD(PDO, pgsqlGetPid)
11361137
}
11371138
/* }}} */
11381139

1139-
1140-
static const zend_function_entry dbh_methods[] = {
1141-
PHP_ME(PDO, pgsqlLOBCreate, NULL, ZEND_ACC_PUBLIC)
1142-
PHP_ME(PDO, pgsqlLOBOpen, NULL, ZEND_ACC_PUBLIC)
1143-
PHP_ME(PDO, pgsqlLOBUnlink, NULL, ZEND_ACC_PUBLIC)
1144-
PHP_ME(PDO, pgsqlCopyFromArray, NULL, ZEND_ACC_PUBLIC)
1145-
PHP_ME(PDO, pgsqlCopyFromFile, NULL, ZEND_ACC_PUBLIC)
1146-
PHP_ME(PDO, pgsqlCopyToArray, NULL, ZEND_ACC_PUBLIC)
1147-
PHP_ME(PDO, pgsqlCopyToFile, NULL, ZEND_ACC_PUBLIC)
1148-
PHP_ME(PDO, pgsqlGetNotify, NULL, ZEND_ACC_PUBLIC)
1149-
PHP_ME(PDO, pgsqlGetPid, NULL, ZEND_ACC_PUBLIC)
1150-
PHP_FE_END
1151-
};
1152-
11531140
static const zend_function_entry *pdo_pgsql_get_driver_methods(pdo_dbh_t *dbh, int kind)
11541141
{
11551142
switch (kind) {
11561143
case PDO_DBH_DRIVER_METHOD_KIND_DBH:
1157-
return dbh_methods;
1144+
return class_PDO_PGSql_Ext_methods;
11581145
default:
11591146
return NULL;
11601147
}

ext/pdo_pgsql/pgsql_driver.stub.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
/** @generate-function-entries */
4+
5+
// These are extension methods for PDO. This is not a real class.
6+
class PDO_PGSql_Ext {
7+
/** @return bool */
8+
public function pgsqlCopyFromArray(string $table_name, array $rows, string $delimiter = "\t", string $null_as = "\\\\N", string $fields = UNKNOWN) {}
9+
10+
/** @return bool */
11+
public function pgsqlCopyFromFile(string $table_name, string $filename, string $delimiter = "\t", string $null_as = "\\\\N", string $fields = UNKNOWN) {}
12+
13+
/** @return array|false */
14+
public function pgsqlCopyToArray(string $table_name, string $delimiter = "\t", string $null_as = "\\\\N", string $fields = UNKNOWN) {}
15+
16+
/** @return bool */
17+
public function pgsqlCopyToFile(string $table_name, string $filename, string $delimiter = "\t", string $null_as = "\\\\N", string $fields = UNKNOWN) {}
18+
19+
/** @return string|false */
20+
public function pgsqlLOBCreate() {}
21+
22+
/** @return resource|false */
23+
public function pgsqlLOBOpen(string $oid, string $mode = "rb") {}
24+
25+
/** @return bool */
26+
public function pgsqlLOBUnlink(string $oid) {}
27+
28+
/** @return array|false */
29+
public function pgsqlGetNotify(int $result_type = PDO::FETCH_USE_DEFAULT, int $ms_timeout = 0) {}
30+
31+
/** @return int */
32+
public function pgsqlGetPid() {}
33+
}

ext/pdo_pgsql/pgsql_driver_arginfo.h

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/* This is a generated file, edit the .stub.php file instead.
2+
* Stub hash: 80c3e9c95db8c68ff3a2c2753aa5e9485af9fe4c */
3+
4+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_PGSql_Ext_pgsqlCopyFromArray, 0, 0, 2)
5+
ZEND_ARG_TYPE_INFO(0, table_name, IS_STRING, 0)
6+
ZEND_ARG_TYPE_INFO(0, rows, IS_ARRAY, 0)
7+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, delimiter, IS_STRING, 0, "\"\\t\"")
8+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, null_as, IS_STRING, 0, "\"\\\\\\\\N\"")
9+
ZEND_ARG_TYPE_INFO(0, fields, IS_STRING, 0)
10+
ZEND_END_ARG_INFO()
11+
12+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_PGSql_Ext_pgsqlCopyFromFile, 0, 0, 2)
13+
ZEND_ARG_TYPE_INFO(0, table_name, IS_STRING, 0)
14+
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
15+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, delimiter, IS_STRING, 0, "\"\\t\"")
16+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, null_as, IS_STRING, 0, "\"\\\\\\\\N\"")
17+
ZEND_ARG_TYPE_INFO(0, fields, IS_STRING, 0)
18+
ZEND_END_ARG_INFO()
19+
20+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_PGSql_Ext_pgsqlCopyToArray, 0, 0, 1)
21+
ZEND_ARG_TYPE_INFO(0, table_name, IS_STRING, 0)
22+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, delimiter, IS_STRING, 0, "\"\\t\"")
23+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, null_as, IS_STRING, 0, "\"\\\\\\\\N\"")
24+
ZEND_ARG_TYPE_INFO(0, fields, IS_STRING, 0)
25+
ZEND_END_ARG_INFO()
26+
27+
#define arginfo_class_PDO_PGSql_Ext_pgsqlCopyToFile arginfo_class_PDO_PGSql_Ext_pgsqlCopyFromFile
28+
29+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_PGSql_Ext_pgsqlLOBCreate, 0, 0, 0)
30+
ZEND_END_ARG_INFO()
31+
32+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_PGSql_Ext_pgsqlLOBOpen, 0, 0, 1)
33+
ZEND_ARG_TYPE_INFO(0, oid, IS_STRING, 0)
34+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_STRING, 0, "\"rb\"")
35+
ZEND_END_ARG_INFO()
36+
37+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_PGSql_Ext_pgsqlLOBUnlink, 0, 0, 1)
38+
ZEND_ARG_TYPE_INFO(0, oid, IS_STRING, 0)
39+
ZEND_END_ARG_INFO()
40+
41+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_PGSql_Ext_pgsqlGetNotify, 0, 0, 0)
42+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, result_type, IS_LONG, 0, "PDO::FETCH_USE_DEFAULT")
43+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ms_timeout, IS_LONG, 0, "0")
44+
ZEND_END_ARG_INFO()
45+
46+
#define arginfo_class_PDO_PGSql_Ext_pgsqlGetPid arginfo_class_PDO_PGSql_Ext_pgsqlLOBCreate
47+
48+
49+
ZEND_METHOD(PDO_PGSql_Ext, pgsqlCopyFromArray);
50+
ZEND_METHOD(PDO_PGSql_Ext, pgsqlCopyFromFile);
51+
ZEND_METHOD(PDO_PGSql_Ext, pgsqlCopyToArray);
52+
ZEND_METHOD(PDO_PGSql_Ext, pgsqlCopyToFile);
53+
ZEND_METHOD(PDO_PGSql_Ext, pgsqlLOBCreate);
54+
ZEND_METHOD(PDO_PGSql_Ext, pgsqlLOBOpen);
55+
ZEND_METHOD(PDO_PGSql_Ext, pgsqlLOBUnlink);
56+
ZEND_METHOD(PDO_PGSql_Ext, pgsqlGetNotify);
57+
ZEND_METHOD(PDO_PGSql_Ext, pgsqlGetPid);
58+
59+
60+
static const zend_function_entry class_PDO_PGSql_Ext_methods[] = {
61+
ZEND_ME(PDO_PGSql_Ext, pgsqlCopyFromArray, arginfo_class_PDO_PGSql_Ext_pgsqlCopyFromArray, ZEND_ACC_PUBLIC)
62+
ZEND_ME(PDO_PGSql_Ext, pgsqlCopyFromFile, arginfo_class_PDO_PGSql_Ext_pgsqlCopyFromFile, ZEND_ACC_PUBLIC)
63+
ZEND_ME(PDO_PGSql_Ext, pgsqlCopyToArray, arginfo_class_PDO_PGSql_Ext_pgsqlCopyToArray, ZEND_ACC_PUBLIC)
64+
ZEND_ME(PDO_PGSql_Ext, pgsqlCopyToFile, arginfo_class_PDO_PGSql_Ext_pgsqlCopyToFile, ZEND_ACC_PUBLIC)
65+
ZEND_ME(PDO_PGSql_Ext, pgsqlLOBCreate, arginfo_class_PDO_PGSql_Ext_pgsqlLOBCreate, ZEND_ACC_PUBLIC)
66+
ZEND_ME(PDO_PGSql_Ext, pgsqlLOBOpen, arginfo_class_PDO_PGSql_Ext_pgsqlLOBOpen, ZEND_ACC_PUBLIC)
67+
ZEND_ME(PDO_PGSql_Ext, pgsqlLOBUnlink, arginfo_class_PDO_PGSql_Ext_pgsqlLOBUnlink, ZEND_ACC_PUBLIC)
68+
ZEND_ME(PDO_PGSql_Ext, pgsqlGetNotify, arginfo_class_PDO_PGSql_Ext_pgsqlGetNotify, ZEND_ACC_PUBLIC)
69+
ZEND_ME(PDO_PGSql_Ext, pgsqlGetPid, arginfo_class_PDO_PGSql_Ext_pgsqlGetPid, ZEND_ACC_PUBLIC)
70+
ZEND_FE_END
71+
};

ext/pdo_sqlite/sqlite_driver_arginfo.h

Lines changed: 1 addition & 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: 5134a0b80848f852557b1c22ec102573d79ed9a4 */
2+
* Stub hash: e367675f85371fb06484e39dd6ccb3433766ffb8 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_SQLite_Ext_sqliteCreateFunction, 0, 0, 2)
55
ZEND_ARG_TYPE_INFO(0, function_name, IS_STRING, 0)

0 commit comments

Comments
 (0)