php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
mysqlnd_reverse_api.c
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Authors: Andrey Hristov <andrey@php.net> |
14 | Johannes Schlüter <johannes@php.net> |
15 | Ulf Wendel <uw@php.net> |
16 +----------------------------------------------------------------------+
17*/
18
19#include "php.h"
20#include "mysqlnd.h"
21#include "mysqlnd_priv.h"
22#include "mysqlnd_debug.h"
23#include "mysqlnd_reverse_api.h"
24
25
26static HashTable mysqlnd_api_ext_ht;
27
28
29/* {{{ mysqlnd_reverse_api_init */
30PHPAPI void
32{
33 zend_hash_init(&mysqlnd_api_ext_ht, 3, NULL, NULL, 1);
34}
35/* }}} */
36
37
38/* {{{ mysqlnd_reverse_api_end */
39PHPAPI void
41{
42 zend_hash_destroy(&mysqlnd_api_ext_ht);
43}
44/* }}} */
45
46
47/* {{{ myslqnd_get_api_extensions */
50{
51 return &mysqlnd_api_ext_ht;
52}
53/* }}} */
54
55
56/* {{{ mysqlnd_reverse_api_register_api */
57PHPAPI void
59{
60 zend_hash_str_add_ptr(&mysqlnd_api_ext_ht, apiext->module->name, strlen(apiext->module->name), (void*)apiext);
61}
62/* }}} */
63
64
65/* {{{ zval_to_mysqlnd */
67zval_to_mysqlnd(zval * zv, const unsigned int client_api_capabilities, unsigned int * save_client_api_capabilities)
68{
70 ZEND_HASH_MAP_FOREACH_PTR(&mysqlnd_api_ext_ht, api) {
71 if (api->conversion_cb) {
73 if (retval) {
74 if (retval->data) {
75 *save_client_api_capabilities = retval->data->m->negotiate_client_api_capabilities(retval->data, client_api_capabilities);
76 }
77 return retval;
78 }
79 }
81 return NULL;
82}
83/* }}} */
zval * zv
Definition ffi.c:3975
#define NULL
Definition gdcache.h:45
PHPAPI void mysqlnd_reverse_api_end(void)
PHPAPI HashTable * mysqlnd_reverse_api_get_api_list(void)
PHPAPI MYSQLND * zval_to_mysqlnd(zval *zv, const unsigned int client_api_capabilities, unsigned int *save_client_api_capabilities)
PHPAPI void mysqlnd_reverse_api_register_api(const MYSQLND_REVERSE_API *apiext)
PHPAPI void mysqlnd_reverse_api_init(void)
struct st_mysqlnd_reverse_api MYSQLND_REVERSE_API
struct st_mysqlnd_connection MYSQLND
#define PHPAPI
Definition php.h:71
const char * name
zend_module_entry * module
MYSQLND *(* conversion_cb)(zval *zv)
struct _zval_struct zval
strlen(string $string)
ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
Definition zend_hash.c:1727
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent)
Definition zend_hash.h:108
#define ZEND_HASH_MAP_FOREACH_PTR(ht, _ptr)
Definition zend_hash.h:1326
#define ZEND_HASH_FOREACH_END()
Definition zend_hash.h:1086
struct _zend_array HashTable
Definition zend_types.h:386
zval retval