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 | Author: Georg Richter <georg@php.net> |
14 +----------------------------------------------------------------------+
15
16 */
17 #ifdef HAVE_CONFIG_H
18 #include <config.h>
19 #endif
20
21 #include <signal.h>
22
23 #include "php.h"
24 #include "php_mysqli_structs.h"
25 #include "zend_exceptions.h"
26
27
28 /* {{{ property driver_report_read */
driver_report_read(mysqli_object * obj,zval * retval,bool quiet)29 static zend_result driver_report_read(mysqli_object *obj, zval *retval, bool quiet)
30 {
31 ZVAL_LONG(retval, MyG(report_mode));
32 return SUCCESS;
33 }
34 /* }}} */
35
36 /* {{{ property driver_report_write */
driver_report_write(mysqli_object * obj,zval * value)37 static zend_result driver_report_write(mysqli_object *obj, zval *value)
38 {
39 ZEND_ASSERT(Z_TYPE_P(value) == IS_LONG);
40 MyG(report_mode) = Z_LVAL_P(value);
41 return SUCCESS;
42 }
43 /* }}} */
44
45 /* {{{ property driver_client_version_read */
driver_client_version_read(mysqli_object * obj,zval * retval,bool quiet)46 static zend_result driver_client_version_read(mysqli_object *obj, zval *retval, bool quiet)
47 {
48 ZVAL_LONG(retval, mysql_get_client_version());
49 return SUCCESS;
50 }
51 /* }}} */
52
53 /* {{{ property driver_client_info_read */
driver_client_info_read(mysqli_object * obj,zval * retval,bool quiet)54 static zend_result driver_client_info_read(mysqli_object *obj, zval *retval, bool quiet)
55 {
56 ZVAL_STRING(retval, (char *)mysql_get_client_info());
57 return SUCCESS;
58 }
59 /* }}} */
60
61 /* {{{ property driver_driver_version_read */
driver_driver_version_read(mysqli_object * obj,zval * retval,bool quiet)62 static zend_result driver_driver_version_read(mysqli_object *obj, zval *retval, bool quiet)
63 {
64 if (quiet) {
65 return FAILURE;
66 }
67 zend_error(E_DEPRECATED, "The driver_version property is deprecated");
68 ZVAL_LONG(retval, MYSQLI_VERSION_ID);
69 return SUCCESS;
70 }
71 /* }}} */
72
73 const mysqli_property_entry mysqli_driver_property_entries[] = {
74 {"client_info", sizeof("client_info") - 1, driver_client_info_read, NULL},
75 {"client_version", sizeof("client_version") - 1, driver_client_version_read, NULL},
76 {"driver_version", sizeof("driver_version") - 1, driver_driver_version_read, NULL},
77 {"report_mode", sizeof("report_mode") - 1, driver_report_read, driver_report_write},
78 {NULL, 0, NULL, NULL}
79 };
80
81