Skip to content

Commit ee5e68c

Browse files
committed
Use PHP 8 arginfo stuff
Needs more polish before merging
1 parent 7ff28e0 commit ee5e68c

File tree

2 files changed

+117
-57
lines changed

2 files changed

+117
-57
lines changed

ibm_db2.c

Lines changed: 5 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ typedef struct _stmt_handle_struct {
200200

201201
/* {{{ ZEND_BEGIN_ARG_INFO
202202
*/
203+
204+
#if PHP_MAJOR_VERSION >= 8
205+
#include <ibm_db2_arginfo.h>
206+
#else
203207
/* XXX: */
204208
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_connect, 0, 0, 3)
205209
ZEND_ARG_INFO(0, database)
@@ -252,15 +256,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_column_privileges, 0, 0, 1)
252256
ZEND_ARG_INFO(0, column_name)
253257
ZEND_END_ARG_INFO()
254258

255-
/* XXX: Must duplicate for aliases? */
256-
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_columnprivileges, 0, 0, 1)
257-
ZEND_ARG_INFO(0, connection)
258-
ZEND_ARG_INFO(0, qualifier)
259-
ZEND_ARG_INFO(0, schema)
260-
ZEND_ARG_INFO(0, table_name)
261-
ZEND_ARG_INFO(0, column_name)
262-
ZEND_END_ARG_INFO()
263-
264259
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_columns, 0, 0, 1)
265260
ZEND_ARG_INFO(0, connection)
266261
ZEND_ARG_INFO(0, qualifier)
@@ -276,27 +271,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_foreign_keys, 0, 0, 4)
276271
ZEND_ARG_INFO(0, table_name)
277272
ZEND_END_ARG_INFO()
278273

279-
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_foreignkeys, 0, 0, 4)
280-
ZEND_ARG_INFO(0, connection)
281-
ZEND_ARG_INFO(0, qualifier)
282-
ZEND_ARG_INFO(0, schema)
283-
ZEND_ARG_INFO(0, table_name)
284-
ZEND_END_ARG_INFO()
285-
286274
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_primary_keys, 0, 0, 4)
287275
ZEND_ARG_INFO(0, connection)
288276
ZEND_ARG_INFO(0, qualifier)
289277
ZEND_ARG_INFO(0, schema)
290278
ZEND_ARG_INFO(0, table_name)
291279
ZEND_END_ARG_INFO()
292280

293-
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_primarykeys, 0, 0, 4)
294-
ZEND_ARG_INFO(0, connection)
295-
ZEND_ARG_INFO(0, qualifier)
296-
ZEND_ARG_INFO(0, schema)
297-
ZEND_ARG_INFO(0, table_name)
298-
ZEND_END_ARG_INFO()
299-
300281
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_procedure_columns, 0, 0, 5)
301282
ZEND_ARG_INFO(0, connection)
302283
ZEND_ARG_INFO(0, qualifier)
@@ -305,14 +286,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_procedure_columns, 0, 0, 5)
305286
ZEND_ARG_INFO(0, parameter)
306287
ZEND_END_ARG_INFO()
307288

308-
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_procedurecolumns, 0, 0, 5)
309-
ZEND_ARG_INFO(0, connection)
310-
ZEND_ARG_INFO(0, qualifier)
311-
ZEND_ARG_INFO(0, schema)
312-
ZEND_ARG_INFO(0, procedure)
313-
ZEND_ARG_INFO(0, parameter)
314-
ZEND_END_ARG_INFO()
315-
316289
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_procedures, 0, 0, 4)
317290
ZEND_ARG_INFO(0, connection)
318291
ZEND_ARG_INFO(0, qualifier)
@@ -328,14 +301,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_special_columns, 0, 0, 5)
328301
ZEND_ARG_INFO(0, scope)
329302
ZEND_END_ARG_INFO()
330303

331-
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_specialcolumns, 0, 0, 5)
332-
ZEND_ARG_INFO(0, connection)
333-
ZEND_ARG_INFO(0, qualifier)
334-
ZEND_ARG_INFO(0, schema)
335-
ZEND_ARG_INFO(0, table_name)
336-
ZEND_ARG_INFO(0, scope)
337-
ZEND_END_ARG_INFO()
338-
339304
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_statistics, 0, 0, 5)
340305
ZEND_ARG_INFO(0, connection)
341306
ZEND_ARG_INFO(0, qualifier)
@@ -351,13 +316,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_table_privileges, 0, 0, 1)
351316
ZEND_ARG_INFO(0, table_name)
352317
ZEND_END_ARG_INFO()
353318

354-
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_tableprivileges, 0, 0, 1)
355-
ZEND_ARG_INFO(0, connection)
356-
ZEND_ARG_INFO(0, qualifier)
357-
ZEND_ARG_INFO(0, schema)
358-
ZEND_ARG_INFO(0, table_name)
359-
ZEND_END_ARG_INFO()
360-
361319
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_tables, 0, 0, 1)
362320
ZEND_ARG_INFO(0, connection)
363321
ZEND_ARG_INFO(0, qualifier)
@@ -501,12 +459,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_set_option, 0, 0, 3)
501459
ZEND_ARG_INFO(0, type)
502460
ZEND_END_ARG_INFO()
503461

504-
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_setoption, 0, 0, 3)
505-
ZEND_ARG_INFO(0, resource)
506-
ZEND_ARG_INFO(0, options)
507-
ZEND_ARG_INFO(0, type)
508-
ZEND_END_ARG_INFO()
509-
510462
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_fetch_object, 0, 0, 1)
511463
ZEND_ARG_INFO(0, stmt)
512464
ZEND_ARG_INFO(0, row_number)
@@ -535,14 +487,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_get_option, 0, 0, 2)
535487
ZEND_ARG_INFO(0, option)
536488
ZEND_END_ARG_INFO()
537489

538-
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_getoption, 0, 0, 2)
539-
ZEND_ARG_INFO(0, resource)
540-
ZEND_ARG_INFO(0, option)
541-
ZEND_END_ARG_INFO()
542-
543490
ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_last_insert_id, 0, 0, 1)
544491
ZEND_ARG_INFO(0, resource)
545492
ZEND_END_ARG_INFO()
493+
#endif
546494

547495
/* }}} */
548496

ibm_db2.stub.php

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<?php
2+
3+
/** @generate-function-entries */
4+
5+
function db2_connect(string $database, ?string $username, ?string $password, array $options = []): resource|false {}
6+
7+
function db2_commit(resource $connection): bool {}
8+
9+
function db2_pconnect(string $database, ?string $username, ?string $password, array $options = []): resource|false {}
10+
11+
function db2_autocommit(resource $connection, ?int $value = null): int|bool {}
12+
13+
function db2_bind_param(resource $connection, int $parameter_number, string $variable_name, ?int $parameter_type, int $data_type = 0, int $precision = -1, int $scale = 0): bool {}
14+
15+
function db2_close(resource $connection): bool {}
16+
17+
#ifdef PASE
18+
function db2_pclose(resource $connection): bool {}
19+
#endif
20+
21+
function db2_column_privileges(resource $connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null, ?string $column_name = null): resource {}
22+
23+
function db2_columns(resource $connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null, ?string $column_name = null): resource {}
24+
25+
function db2_foreign_keys(resource $connection, ?string $qualifier, ?string $schema, string $table_name): resource {}
26+
27+
function db2_primary_keys(resource $connection, ?string $qualifier, ?string $schema, string $table_name): resource {}
28+
29+
function db2_procedure_columns(resource $connection, ?string $qualifier, string $schema, string $procedure, ?string $parameter): resource {}
30+
31+
function db2_procedures(resource $connection, ?string $qualifier, string $schema, string $procedure): resource {}
32+
33+
function db2_special_columns(resource $connection, ?string $qualifier, string $schema, string $table_name, int $scope): resource {}
34+
35+
function db2_statistics(resource $connection, ?string $qualifier, ?string $schema, string $table_name, bool|int $unique): resource {}
36+
37+
function db2_table_privileges(resource $connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null): resource {}
38+
39+
function db2_tables(resource $connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null, ?string $table_type = null): resource {}
40+
41+
function db2_exec(resource $connection, string $statement, array $options = []): resource|false {}
42+
43+
function db2_prepare(resource $connection, string $statement, array $options = []): resource|false {}
44+
45+
function db2_execute(resource $stmt, array $options = []): bool {}
46+
47+
#ifndef PASE
48+
/* XXX: Not documented and not supported on PASE. */
49+
function db2_execute_many(resource $stmt, array $options = []): int|false {}
50+
#endif
51+
52+
function db2_stmt_errormsg(?resource $stmt = null): string {}
53+
54+
function db2_stmt_error(?resource $stmt = null): string {}
55+
56+
function db2_conn_errormsg(?resource $connection = null): string {}
57+
58+
function db2_conn_error(?resource $connection = null): string {}
59+
60+
function db2_next_result(resource $stmt): resource|false {}
61+
62+
function db2_num_fields(resource $stmt): int|false {}
63+
64+
function db2_num_rows(resource $stmt): int|false {}
65+
66+
function db2_field_name(resource $stmt, int|string $column): string|false {}
67+
68+
function db2_field_display_size(resource $stmt, int|string $column): int|false {}
69+
70+
function db2_field_num(resource $stmt, int|string $column): int|false {}
71+
72+
function db2_field_precision(resource $stmt, int|string $column): int|false {}
73+
74+
function db2_field_scale(resource $stmt, int|string $column): int|false {}
75+
76+
function db2_field_type(resource $stmt, int|string $column): string|false {}
77+
78+
function db2_field_width(resource $stmt, int|string $column): int|false {}
79+
80+
function db2_cursor_type(resource $stmt): int {}
81+
82+
function db2_rollback(resource $connection): bool {}
83+
84+
function db2_free_stmt(resource $stmt): bool {}
85+
86+
function db2_result(resource $stmt, int|string $column): object|null {}
87+
88+
function db2_fetch_row(resource $stmt, ?int $row_number = null): bool {}
89+
90+
function db2_fetch_assoc(resource $stmt, ?int $row_number = null): array|false {}
91+
92+
function db2_fetch_array(resource $stmt, ?int $row_number = null): array|false {}
93+
94+
function db2_fetch_both(resource $stmt, ?int $row_number = null): array|false {}
95+
96+
function db2_fetch_object(resource $stmt, ?int $row_number = null): object|false {}
97+
98+
function db2_free_result(resource $stmt): bool {}
99+
100+
function db2_set_option(resource $resource, array $options, int $type): bool {}
101+
102+
function db2_client_info(resource $connection): object|false {}
103+
104+
function db2_server_info(resource $connection): object|false {}
105+
106+
function db2_escape_string(string $string_literal): string {}
107+
108+
function db2_lob_read(resource $stmt, int $colnum, int $length): string|false {}
109+
110+
function db2_get_option(resource $stmt, string $option): string|false {}
111+
112+
function db2_last_insert_id(resource $stmt): string {}

0 commit comments

Comments
 (0)