PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - ext/mysqli - mysqli_driver.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 18 20 90.0 %
Date: 2014-10-30 Functions: 8 9 88.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :   +----------------------------------------------------------------------+
       3             :   | PHP Version 7                                                        |
       4             :   +----------------------------------------------------------------------+
       5             :   | Copyright (c) 1997-2014 The PHP Group                                |
       6             :   +----------------------------------------------------------------------+
       7             :   | This source file is subject to version 3.01 of the PHP license,      |
       8             :   | that is bundled with this package in the file LICENSE, and is        |
       9             :   | available through the world-wide-web at the following url:           |
      10             :   | http://www.php.net/license/3_01.txt                                  |
      11             :   | If you did not receive a copy of the PHP license and are unable to   |
      12             :   | obtain it through the world-wide-web, please send a note to          |
      13             :   | license@php.net so we can mail you a copy immediately.               |
      14             :   +----------------------------------------------------------------------+
      15             :   | Author: Georg Richter <georg@php.net>                                |
      16             :   +----------------------------------------------------------------------+
      17             : 
      18             : */
      19             : #ifdef HAVE_CONFIG_H
      20             : #include "config.h"
      21             : #endif
      22             : 
      23             : #include <signal.h>
      24             : 
      25             : #include "php.h"
      26             : #include "php_ini.h"
      27             : #include "ext/standard/info.h"
      28             : #include "php_mysqli_structs.h"
      29             : #include "zend_exceptions.h"
      30             : #include "mysqli_fe.h"
      31             : 
      32             : #define MAP_PROPERTY_MYG_BOOL_READ(name, value) \
      33             : static zval *name(mysqli_object *obj, zval *retval TSRMLS_DC) \
      34             : { \
      35             :         ZVAL_BOOL(retval, MyG(value)); \
      36             :         return retval; \
      37             : } \
      38             : 
      39             : #define MAP_PROPERTY_MYG_BOOL_WRITE(name, value) \
      40             : static int name(mysqli_object *obj, zval *value TSRMLS_DC) \
      41             : { \
      42             :         MyG(value) = Z_LVAL_P(value) > 0; \
      43             :         return SUCCESS; \
      44             : } \
      45             : 
      46             : #define MAP_PROPERTY_MYG_LONG_READ(name, value) \
      47             : static zval *name(mysqli_object *obj, zval *retval TSRMLS_DC) \
      48             : { \
      49             :         ZVAL_LONG(retval, MyG(value)); \
      50             :         return retval; \
      51             : } \
      52             : 
      53             : #define MAP_PROPERTY_MYG_LONG_WRITE(name, value) \
      54             : static int name(mysqli_object *obj, zval *value TSRMLS_DC) \
      55             : { \
      56             :         MyG(value) = Z_LVAL_P(value); \
      57             :         return SUCCESS; \
      58             : } \
      59             : 
      60             : #define MAP_PROPERTY_MYG_STRING_READ(name, value) \
      61             : static zval *name(mysqli_object *obj, zval *retval TSRMLS_DC) \
      62             : { \
      63             :         ZVAL_STRING(retval, MyG(value)); \
      64             :         return retval; \
      65             : } \
      66             : 
      67             : #define MAP_PROPERTY_MYG_STRING_WRITE(name, value) \
      68             : static int name(mysqli_object *obj, zval *value TSRMLS_DC) \
      69             : { \
      70             :         MyG(value) = Z_STRVAL_P(value); \
      71             :         return SUCCESS; \
      72             : } \
      73             : 
      74             : /* {{{ property driver_report_write */
      75           5 : static int driver_report_write(mysqli_object *obj, zval *value TSRMLS_DC)
      76             : {
      77           5 :         MyG(report_mode) = Z_LVAL_P(value);
      78             :         /*FIXME*/
      79             :         /* zend_replace_error_handling(MyG(report_mode) & MYSQLI_REPORT_STRICT ? EH_THROW : EH_NORMAL, NULL, NULL TSRMLS_CC); */
      80           5 :         return SUCCESS;
      81             : }
      82             : /* }}} */
      83             : 
      84             : /* {{{ property driver_embedded_read */
      85         259 : static zval *driver_embedded_read(mysqli_object *obj, zval *retval TSRMLS_DC)
      86             : {
      87             : #ifdef HAVE_EMBEDDED_MYSQLI
      88             :         ZVAL_BOOL(retval, 1);
      89             : #else
      90         259 :         ZVAL_BOOL(retval, 0);
      91             : #endif
      92         259 :         return retval;
      93             : }
      94             : /* }}} */
      95             : 
      96             : /* {{{ property driver_client_version_read */
      97           4 : static zval *driver_client_version_read(mysqli_object *obj, zval *retval TSRMLS_DC)
      98             : {
      99           4 :         ZVAL_LONG(retval, MYSQL_VERSION_ID);
     100           4 :         return retval;
     101             : }
     102             : /* }}} */
     103             : 
     104             : /* {{{ property driver_client_info_read */
     105           4 : static zval *driver_client_info_read(mysqli_object *obj, zval *retval TSRMLS_DC)
     106             : {
     107           8 :         ZVAL_STRING(retval, (char *)mysql_get_client_info());
     108           4 :         return retval;
     109             : }
     110             : /* }}} */
     111             : 
     112             : /* {{{ property driver_driver_version_read */
     113           4 : static zval *driver_driver_version_read(mysqli_object *obj, zval *retval TSRMLS_DC)
     114             : {
     115           4 :         ZVAL_LONG(retval, MYSQLI_VERSION_ID);
     116           4 :         return retval;
     117             : }
     118             : /* }}} */
     119             : 
     120           3 : MAP_PROPERTY_MYG_BOOL_READ(driver_reconnect_read, reconnect)
     121           3 : MAP_PROPERTY_MYG_BOOL_WRITE(driver_reconnect_write, reconnect)
     122           6 : MAP_PROPERTY_MYG_LONG_READ(driver_report_read, report_mode)
     123             : 
     124           0 : ZEND_FUNCTION(mysqli_driver_construct)
     125             : {
     126             : #if G0
     127             :         MYSQLI_RESOURCE         *mysqli_resource;
     128             : 
     129             :         mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
     130             :         mysqli_resource->ptr = 1;
     131             :         mysqli_resource->status = (ZEND_NUM_ARGS() == 1) ? MYSQLI_STATUS_INITIALIZED : MYSQLI_STATUS_VALID;
     132             :         (Z_MYSQLI_P(getThis()))->ptr = mysqli_resource;
     133             : #endif
     134           0 : }
     135             : 
     136             : const mysqli_property_entry mysqli_driver_property_entries[] = {
     137             :         {"client_info", sizeof("client_info") - 1, driver_client_info_read, NULL},
     138             :         {"client_version", sizeof("client_version") - 1, driver_client_version_read, NULL},
     139             :         {"driver_version", sizeof("driver_version") - 1, driver_driver_version_read, NULL},
     140             :         {"embedded", sizeof("embedded") - 1, driver_embedded_read, NULL},
     141             :         {"reconnect", sizeof("reconnect") - 1, driver_reconnect_read, driver_reconnect_write},
     142             :         {"report_mode", sizeof("report_mode") - 1, driver_report_read, driver_report_write},
     143             :         {NULL, 0, NULL, NULL}
     144             : };
     145             : 
     146             : /* {{{ mysqli_driver_methods[]
     147             :  */
     148             : const zend_function_entry mysqli_driver_methods[] = {
     149             : #if defined(HAVE_EMBEDDED_MYSQLI)
     150             :         PHP_FALIAS(embedded_server_start, mysqli_embedded_server_start, NULL)
     151             :         PHP_FALIAS(embedded_server_end, mysqli_embedded_server_end, NULL)
     152             : #endif
     153             :         {NULL, NULL, NULL}
     154             : };
     155             : /* }}} */
     156             : 
     157             : /*
     158             :  * Local variables:
     159             :  * tab-width: 4
     160             :  * c-basic-offset: 4
     161             :  * indent-tabs-mode: t
     162             :  * End:
     163             :  * vim600: noet sw=4 ts=4 fdm=marker
     164             :  * vim<600: noet sw=4 ts=4
     165             :  */

Generated by: LCOV version 1.10

Generated at Thu, 30 Oct 2014 07:41:33 +0000 (46 hours ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.