com php-src: Add stubs for PDO SQLite extension methods: ext/pdo_sqlite/sqlite_driver.c ext/pdo_sqlite/sqlite _driver.stub.php
ext/pdo_sqlite/sqlite_driver_arg info.h ext/pdo_sqlite/tests/pdo_sqlite_createaggregat e_002.phpt ext/pdo_sqlite/tests/pdo_sqlite_cr
eatefunction_002.phpt

From: Date: Tue, 21 Jul 2020 10:49:36 +0000
Subject: com php-src: Add stubs for PDO SQLite extension methods: ext/pdo_sqlite/sqlite_driver.c ext/pdo_sqlite/sqlite _driver.stub.php
ext/pdo_sqlite/sqlite_driver_arg info.h ext/pdo_sqlite/tests/pdo_sqlite_createaggregat e_002.phpt ext/pdo_sqlite/tests/pdo_sqlite_cr
eatefunction_002.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-112285@lists.php.net to get a copy of this message
Commit: 1afcced1f0dfc8afd12bef4fb2cb08048edfd8af Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 21 Jul 2020 12:33:25 +0200 Parents: 047474c3b4dddd997ee3b8f66d0c4f091a40c02c Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1afcced1f0dfc8afd12bef4fb2cb08048edfd8af Log: Add stubs for PDO SQLite extension methods Putting these under a dummy PDO_SQLite_Ext class. Changed paths: M ext/pdo_sqlite/sqlite_driver.c A ext/pdo_sqlite/sqlite_driver.stub.php A ext/pdo_sqlite/sqlite_driver_arginfo.h M ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt M ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt Diff: diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index c0962ff3f9...090cb41c08 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -26,6 +26,7 @@ #include "php_pdo_sqlite.h" #include "php_pdo_sqlite_int.h" #include "zend_exceptions.h" +#include "sqlite_driver_arginfo.h" int _pdo_sqlite_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line) /* {{{ */ { @@ -516,7 +517,7 @@ static int php_sqlite3_collation_callback(void *context, /* {{{ bool SQLite::sqliteCreateFunction(string name, callable callback [, int argcount, int flags]) Registers a UDF with the sqlite db handle */ -static PHP_METHOD(SQLite, sqliteCreateFunction) +PHP_METHOD(PDO_SQLite_Ext, sqliteCreateFunction) { struct pdo_sqlite_func *func; zend_fcall_info fci; @@ -583,7 +584,7 @@ static PHP_METHOD(SQLite, sqliteCreateFunction) aggregate UDF. */ -static PHP_METHOD(SQLite, sqliteCreateAggregate) +PHP_METHOD(PDO_SQLite_Ext, sqliteCreateAggregate) { struct pdo_sqlite_func *func; zend_fcall_info step_fci, fini_fci; @@ -634,7 +635,7 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate) /* {{{ bool SQLite::sqliteCreateCollation(string name, callable callback) Registers a collation with the sqlite db handle */ -static PHP_METHOD(SQLite, sqliteCreateCollation) +PHP_METHOD(PDO_SQLite_Ext, sqliteCreateCollation) { struct pdo_sqlite_collation *collation; zend_fcall_info fci; @@ -674,18 +675,11 @@ static PHP_METHOD(SQLite, sqliteCreateCollation) } /* }}} */ -static const zend_function_entry dbh_methods[] = { - PHP_ME(SQLite, sqliteCreateFunction, NULL, ZEND_ACC_PUBLIC) - PHP_ME(SQLite, sqliteCreateAggregate, NULL, ZEND_ACC_PUBLIC) - PHP_ME(SQLite, sqliteCreateCollation, NULL, ZEND_ACC_PUBLIC) - PHP_FE_END -}; - static const zend_function_entry *get_driver_methods(pdo_dbh_t *dbh, int kind) { switch (kind) { case PDO_DBH_DRIVER_METHOD_KIND_DBH: - return dbh_methods; + return class_PDO_SQLite_Ext_methods; default: return NULL; diff --git a/ext/pdo_sqlite/sqlite_driver.stub.php b/ext/pdo_sqlite/sqlite_driver.stub.php new file mode 100644 index 0000000000..eafd3c0c48 --- /dev/null +++ b/ext/pdo_sqlite/sqlite_driver.stub.php @@ -0,0 +1,15 @@ +<?php + +/** @generate-function-entries */ + +// These are extension methods for PDO. This is not a real class. +class PDO_SQLite_Ext { + /** @return bool */ + public function sqliteCreateFunction(string $function_name, callable $callback, int $num_args = -1, int $flags = 0) {} + + /** @return bool */ + public function sqliteCreateAggregate(string $function_name, callable $step_func, callable $finalize_func, int $num_args = -1) {} + + /** @return bool */ + public function sqliteCreateCollation(string $name, callable $callback) {} +} diff --git a/ext/pdo_sqlite/sqlite_driver_arginfo.h b/ext/pdo_sqlite/sqlite_driver_arginfo.h new file mode 100644 index 0000000000..1eb797e7cc --- /dev/null +++ b/ext/pdo_sqlite/sqlite_driver_arginfo.h @@ -0,0 +1,34 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 5134a0b80848f852557b1c22ec102573d79ed9a4 */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_SQLite_Ext_sqliteCreateFunction, 0, 0, 2) + ZEND_ARG_TYPE_INFO(0, function_name, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, num_args, IS_LONG, 0, "-1") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_SQLite_Ext_sqliteCreateAggregate, 0, 0, 3) + ZEND_ARG_TYPE_INFO(0, function_name, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, step_func, IS_CALLABLE, 0) + ZEND_ARG_TYPE_INFO(0, finalize_func, IS_CALLABLE, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, num_args, IS_LONG, 0, "-1") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_SQLite_Ext_sqliteCreateCollation, 0, 0, 2) + ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0) +ZEND_END_ARG_INFO() + + +ZEND_METHOD(PDO_SQLite_Ext, sqliteCreateFunction); +ZEND_METHOD(PDO_SQLite_Ext, sqliteCreateAggregate); +ZEND_METHOD(PDO_SQLite_Ext, sqliteCreateCollation); + + +static const zend_function_entry class_PDO_SQLite_Ext_methods[] = { + ZEND_ME(PDO_SQLite_Ext, sqliteCreateFunction, arginfo_class_PDO_SQLite_Ext_sqliteCreateFunction, ZEND_ACC_PUBLIC) + ZEND_ME(PDO_SQLite_Ext, sqliteCreateAggregate, arginfo_class_PDO_SQLite_Ext_sqliteCreateAggregate, ZEND_ACC_PUBLIC) + ZEND_ME(PDO_SQLite_Ext, sqliteCreateCollation, arginfo_class_PDO_SQLite_Ext_sqliteCreateCollation, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt index 04e4e3076b..5660288af3 100644 --- a/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt +++ b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt @@ -20,5 +20,5 @@ try { ?> --EXPECT-- -PDO::sqliteCreateAggregate(): Argument #2 must be a valid callback, function "a" not found or invalid function name -PDO::sqliteCreateAggregate(): Argument #3 must be a valid callback, function "" not found or invalid function name +PDO::sqliteCreateAggregate(): Argument #2 ($step_func) must be a valid callback, function "a" not found or invalid function name +PDO::sqliteCreateAggregate(): Argument #3 ($finalize_func) must be a valid callback, function "" not found or invalid function name diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt index d0a87201dc..958ea0c484 100644 --- a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt +++ b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt @@ -18,4 +18,4 @@ try { ?> --EXPECT-- -PDO::sqliteCreateFunction(): Argument #2 must be a valid callback, function "bar" not found or invalid function name +PDO::sqliteCreateFunction(): Argument #2 ($callback) must be a valid callback, function "bar" not found or invalid function name

« previous php.cvs (#112285) next »