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/mysqlnd - mysqlnd_ext_plugin.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 29 120 24.2 %
Date: 2016-08-24 Functions: 13 34 38.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :   +----------------------------------------------------------------------+
       3             :   | PHP Version 7                                                        |
       4             :   +----------------------------------------------------------------------+
       5             :   | Copyright (c) 2006-2016 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             :   | Authors: Andrey Hristov <andrey@php.net>                             |
      16             :   |          Johannes Schlüter <johannes@php.net>                        |
      17             :   |          Ulf Wendel <uw@php.net>                                     |
      18             :   +----------------------------------------------------------------------+
      19             : */
      20             : 
      21             : #include "php.h"
      22             : #include "mysqlnd.h"
      23             : #include "mysqlnd_priv.h"
      24             : #include "mysqlnd_result.h"
      25             : #include "mysqlnd_debug.h"
      26             : #include "mysqlnd_commands.h"
      27             : #include "mysqlnd_ext_plugin.h"
      28             : 
      29             : static struct st_mysqlnd_conn_methods * mysqlnd_conn_methods;
      30             : static struct st_mysqlnd_conn_data_methods * mysqlnd_conn_data_methods;
      31             : static struct st_mysqlnd_stmt_methods * mysqlnd_stmt_methods;
      32             : 
      33             : /* {{{ mysqlnd_plugin__get_plugin_connection_data */
      34             : static void **
      35           0 : mysqlnd_plugin__get_plugin_connection_data(const MYSQLND * conn, const unsigned int plugin_id)
      36             : {
      37           0 :         DBG_ENTER("mysqlnd_plugin__get_plugin_connection_data");
      38           0 :         DBG_INF_FMT("plugin_id=%u", plugin_id);
      39           0 :         if (!conn || plugin_id >= mysqlnd_plugin_count()) {
      40           0 :                 return NULL;
      41             :         }
      42           0 :         DBG_RETURN((void *)((char *)conn + sizeof(MYSQLND) + plugin_id * sizeof(void *)));
      43             : }
      44             : /* }}} */
      45             : 
      46             : 
      47             : /* {{{ mysqlnd_plugin__get_plugin_connection_data_data */
      48             : static void **
      49           0 : mysqlnd_plugin__get_plugin_connection_data_data(const MYSQLND_CONN_DATA * conn, const unsigned int plugin_id)
      50             : {
      51           0 :         DBG_ENTER("mysqlnd_plugin__get_plugin_connection_data_data");
      52           0 :         DBG_INF_FMT("plugin_id=%u", plugin_id);
      53           0 :         if (!conn || plugin_id >= mysqlnd_plugin_count()) {
      54           0 :                 return NULL;
      55             :         }
      56           0 :         DBG_RETURN((void *)((char *)conn + sizeof(MYSQLND_CONN_DATA) + plugin_id * sizeof(void *)));
      57             : }
      58             : /* }}} */
      59             : 
      60             : 
      61             : /* {{{ mysqlnd_plugin__get_plugin_result_data */
      62             : static void **
      63           0 : mysqlnd_plugin__get_plugin_result_data(const MYSQLND_RES * result, const unsigned int plugin_id)
      64             : {
      65           0 :         DBG_ENTER("mysqlnd_plugin__get_plugin_result_data");
      66           0 :         DBG_INF_FMT("plugin_id=%u", plugin_id);
      67           0 :         if (!result || plugin_id >= mysqlnd_plugin_count()) {
      68           0 :                 return NULL;
      69             :         }
      70           0 :         DBG_RETURN((void *)((char *)result + sizeof(MYSQLND_RES) + plugin_id * sizeof(void *)));
      71             : }
      72             : /* }}} */
      73             : 
      74             : 
      75             : /* {{{ _mysqlnd_plugin__get_plugin_result_unbuffered_data */
      76             : static void **
      77           0 : mysqlnd_plugin__get_plugin_result_unbuffered_data(const MYSQLND_RES_UNBUFFERED * result, const unsigned int plugin_id)
      78             : {
      79           0 :         DBG_ENTER("mysqlnd_plugin__get_plugin_result_data");
      80           0 :         DBG_INF_FMT("plugin_id=%u", plugin_id);
      81           0 :         if (!result || plugin_id >= mysqlnd_plugin_count()) {
      82           0 :                 return NULL;
      83             :         }
      84           0 :         DBG_RETURN((void *)((char *)result + sizeof(MYSQLND_RES_UNBUFFERED) + plugin_id * sizeof(void *)));
      85             : }
      86             : /* }}} */
      87             : 
      88             : 
      89             : /* {{{ _mysqlnd_plugin__get_plugin_result_buffered_data */
      90             : static void **
      91           0 : mysqlnd_plugin__get_plugin_result_buffered_data_zval(const MYSQLND_RES_BUFFERED_ZVAL * result, const unsigned int plugin_id)
      92             : {
      93           0 :         DBG_ENTER("_mysqlnd_plugin__get_plugin_result_data");
      94           0 :         DBG_INF_FMT("plugin_id=%u", plugin_id);
      95           0 :         if (!result || plugin_id >= mysqlnd_plugin_count()) {
      96           0 :                 return NULL;
      97             :         }
      98           0 :         DBG_RETURN((void *)((char *)result + sizeof(MYSQLND_RES_BUFFERED_ZVAL) + plugin_id * sizeof(void *)));
      99             : }
     100             : /* }}} */
     101             : 
     102             : /* {{{ mysqlnd_plugin__get_plugin_result_buffered_data */
     103             : static void **
     104           0 : mysqlnd_plugin__get_plugin_result_buffered_data_c(const MYSQLND_RES_BUFFERED_C * result, const unsigned int plugin_id)
     105             : {
     106           0 :         DBG_ENTER("mysqlnd_plugin__get_plugin_result_data");
     107           0 :         DBG_INF_FMT("plugin_id=%u", plugin_id);
     108           0 :         if (!result || plugin_id >= mysqlnd_plugin_count()) {
     109           0 :                 return NULL;
     110             :         }
     111           0 :         DBG_RETURN((void *)((char *)result + sizeof(MYSQLND_RES_BUFFERED_C) + plugin_id * sizeof(void *)));
     112             : }
     113             : /* }}} */
     114             : 
     115             : 
     116             : /* {{{ mysqlnd_plugin__get_plugin_protocol_data */
     117             : static void **
     118           0 : mysqlnd_plugin__get_plugin_protocol_data(const MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * factory, const unsigned int plugin_id)
     119             : {
     120           0 :         DBG_ENTER("mysqlnd_plugin__get_plugin_protocol_data");
     121           0 :         DBG_INF_FMT("plugin_id=%u", plugin_id);
     122           0 :         if (!factory || plugin_id >= mysqlnd_plugin_count()) {
     123           0 :                 return NULL;
     124             :         }
     125           0 :         DBG_RETURN((void *)((char *)factory + sizeof(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY) + plugin_id * sizeof(void *)));
     126             : }
     127             : /* }}} */
     128             : 
     129             : 
     130             : /* {{{ mysqlnd_plugin__get_plugin_stmt_data */
     131             : static void **
     132           0 : mysqlnd_plugin__get_plugin_stmt_data(const MYSQLND_STMT * stmt, const unsigned int plugin_id)
     133             : {
     134           0 :         DBG_ENTER("mysqlnd_plugin__get_plugin_stmt_data");
     135           0 :         DBG_INF_FMT("plugin_id=%u", plugin_id);
     136           0 :         if (!stmt || plugin_id >= mysqlnd_plugin_count()) {
     137           0 :                 return NULL;
     138             :         }
     139           0 :         DBG_RETURN((void *)((char *)stmt + sizeof(MYSQLND_STMT) + plugin_id * sizeof(void *)));
     140             : }
     141             : /* }}} */
     142             : 
     143             : 
     144             : /* {{{ mysqlnd_plugin__get_plugin_pfc_data */
     145             : static void **
     146           0 : mysqlnd_plugin__get_plugin_pfc_data(const MYSQLND_PFC * pfc, const unsigned int plugin_id)
     147             : {
     148           0 :         DBG_ENTER("mysqlnd_plugin__get_plugin_pfc_data");
     149           0 :         DBG_INF_FMT("plugin_id=%u", plugin_id);
     150           0 :         if (!pfc || plugin_id >= mysqlnd_plugin_count()) {
     151           0 :                 return NULL;
     152             :         }
     153           0 :         DBG_RETURN((void *)((char *)pfc + sizeof(MYSQLND_PFC) + plugin_id * sizeof(void *)));
     154             : }
     155             : /* }}} */
     156             : 
     157             : 
     158             : /* {{{ _mysqlnd_plugin__get_plugin_vio_data */
     159             : static void **
     160           0 : mysqlnd_plugin__get_plugin_vio_data(const MYSQLND_VIO * vio, const unsigned int plugin_id)
     161             : {
     162           0 :         DBG_ENTER("_mysqlnd_plugin__get_plugin_vio_data");
     163           0 :         DBG_INF_FMT("plugin_id=%u", plugin_id);
     164           0 :         if (!vio || plugin_id >= mysqlnd_plugin_count()) {
     165           0 :                 return NULL;
     166             :         }
     167           0 :         DBG_RETURN((void *)((char *)vio + sizeof(MYSQLND_VIO) + plugin_id * sizeof(void *)));
     168             : }
     169             : /* }}} */
     170             : 
     171             : struct st_mysqlnd_plugin__plugin_area_getters mysqlnd_plugin_area_getters =
     172             : {
     173             :         mysqlnd_plugin__get_plugin_connection_data,
     174             :         mysqlnd_plugin__get_plugin_connection_data_data,
     175             :         mysqlnd_plugin__get_plugin_result_data,
     176             :         mysqlnd_plugin__get_plugin_result_unbuffered_data,
     177             :         mysqlnd_plugin__get_plugin_result_buffered_data_zval,
     178             :         mysqlnd_plugin__get_plugin_result_buffered_data_c,
     179             :         mysqlnd_plugin__get_plugin_stmt_data,
     180             :         mysqlnd_plugin__get_plugin_protocol_data,
     181             :         mysqlnd_plugin__get_plugin_pfc_data,
     182             :         mysqlnd_plugin__get_plugin_vio_data,
     183             : };
     184             : 
     185             : 
     186             : 
     187             : /* {{{ _mysqlnd_object_factory_get_methods */
     188             : static MYSQLND_CLASS_METHODS_TYPE(mysqlnd_object_factory) *
     189           0 : _mysqlnd_object_factory_get_methods()
     190             : {
     191           0 :         return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_object_factory);
     192             : }
     193             : /* }}} */
     194             : 
     195             : /* {{{ mysqlnd_conn_set_methods */
     196             : static void
     197           0 : _mysqlnd_object_factory_set_methods(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_object_factory) *methods)
     198             : {
     199           0 :         MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_object_factory) = *methods;
     200           0 : }
     201             : /* }}} */
     202             : 
     203             : 
     204             : /* {{{ _mysqlnd_conn_get_methods */
     205             : static MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn) *
     206        1739 : _mysqlnd_conn_get_methods()
     207             : {
     208        1739 :         return mysqlnd_conn_methods;
     209             : }
     210             : /* }}} */
     211             : 
     212             : /* {{{ _mysqlnd_conn_set_methods */
     213             : static void
     214       23504 : _mysqlnd_conn_set_methods(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn) *methods)
     215             : {
     216       23504 :         mysqlnd_conn_methods = methods;
     217       23504 : }
     218             : /* }}} */
     219             : 
     220             : 
     221             : /* {{{ _mysqlnd_conn_data_get_methods */
     222             : static MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn_data) *
     223        1739 : _mysqlnd_conn_data_get_methods()
     224             : {
     225        1739 :         return mysqlnd_conn_data_methods;
     226             : }
     227             : /* }}} */
     228             : 
     229             : /* {{{ _mysqlnd_conn_data_set_methods */
     230             : static void
     231       23504 : _mysqlnd_conn_data_set_methods(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn_data) * methods)
     232             : {
     233       23504 :         mysqlnd_conn_data_methods = methods;
     234       23504 : }
     235             : /* }}} */
     236             : 
     237             : 
     238             : /* {{{ _mysqlnd_result_get_methods */
     239             : static MYSQLND_CLASS_METHODS_TYPE(mysqlnd_res) *
     240        6048 : _mysqlnd_result_get_methods()
     241             : {
     242        6048 :         return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_res);
     243             : }
     244             : /* }}} */
     245             : 
     246             : 
     247             : /* {{{ _mysqlnd_result_set_methods */
     248             : static void
     249           0 : _mysqlnd_result_set_methods(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_res) * methods)
     250             : {
     251           0 :         MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_res) = *methods;
     252           0 : }
     253             : /* }}} */
     254             : 
     255             : 
     256             : /* {{{ _mysqlnd_result_unbuffered_get_methods */
     257             : static MYSQLND_CLASS_METHODS_TYPE(mysqlnd_result_unbuffered) *
     258        1997 : _mysqlnd_result_unbuffered_get_methods()
     259             : {
     260        1997 :         return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_result_unbuffered);
     261             : }
     262             : /* }}} */
     263             : 
     264             : 
     265             : /* {{{ _mysqlnd_result_unbuffered_set_methods */
     266             : static void
     267           0 : _mysqlnd_result_unbuffered_set_methods(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_result_unbuffered) * methods)
     268             : {
     269           0 :         MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_result_unbuffered) = *methods;
     270           0 : }
     271             : /* }}} */
     272             : 
     273             : 
     274             : /* {{{ _mysqlnd_result_buffered_get_methods */
     275             : static MYSQLND_CLASS_METHODS_TYPE(mysqlnd_result_buffered) *
     276        3327 : _mysqlnd_result_buffered_get_methods()
     277             : {
     278        3327 :         return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_result_buffered);
     279             : }
     280             : /* }}} */
     281             : 
     282             : 
     283             : /* {{{ _mysqlnd_result_buffered_set_methods */
     284             : static void
     285           0 : _mysqlnd_result_buffered_set_methods(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_result_buffered) * methods)
     286             : {
     287           0 :         MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_result_buffered) = *methods;
     288           0 : }
     289             : /* }}} */
     290             : 
     291             : 
     292             : /* {{{ _mysqlnd_stmt_get_methods */
     293             : static MYSQLND_CLASS_METHODS_TYPE(mysqlnd_stmt) *
     294        4259 : _mysqlnd_stmt_get_methods()
     295             : {
     296        4259 :         return mysqlnd_stmt_methods;
     297             : }
     298             : /* }}} */
     299             : 
     300             : 
     301             : /* {{{ _mysqlnd_stmt_set_methods */
     302             : static void
     303       23504 : _mysqlnd_stmt_set_methods(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_stmt) *methods)
     304             : {
     305       23504 :         mysqlnd_stmt_methods = methods;
     306       23504 : }
     307             : /* }}} */
     308             : 
     309             : 
     310             : /* {{{ _mysqlnd_protocol_payload_decoder_factory_get_methods */
     311             : static MYSQLND_CLASS_METHODS_TYPE(mysqlnd_protocol_payload_decoder_factory) *
     312           0 : _mysqlnd_protocol_payload_decoder_factory_get_methods()
     313             : {
     314           0 :         return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_protocol_payload_decoder_factory);
     315             : }
     316             : /* }}} */
     317             : 
     318             : 
     319             : /* {{{ _mysqlnd_protocol_payload_decoder_factory_set_methods */
     320             : static void
     321           0 : _mysqlnd_protocol_payload_decoder_factory_set_methods(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_protocol_payload_decoder_factory) * methods)
     322             : {
     323           0 :         MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_protocol_payload_decoder_factory) = *methods;
     324           0 : }
     325             : /* }}} */
     326             : 
     327             : 
     328             : /* {{{ _mysqlnd_pfc_get_methods */
     329             : static MYSQLND_CLASS_METHODS_TYPE(mysqlnd_protocol_packet_frame_codec) *
     330        1739 : _mysqlnd_pfc_get_methods()
     331             : {
     332        1739 :         return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_protocol_packet_frame_codec);
     333             : }
     334             : /* }}} */
     335             : 
     336             : 
     337             : /* {{{ _mysqlnd_pfc_set_methods */
     338             : static void
     339           0 : _mysqlnd_pfc_set_methods(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_protocol_packet_frame_codec) * methods)
     340             : {
     341           0 :         MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_protocol_packet_frame_codec) = *methods;
     342           0 : }
     343             : /* }}} */
     344             : 
     345             : 
     346             : /* {{{ _mysqlnd_vio_get_methods */
     347             : static MYSQLND_CLASS_METHODS_TYPE(mysqlnd_vio) *
     348        1739 : _mysqlnd_vio_get_methods()
     349             : {
     350        1739 :         return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_vio);
     351             : }
     352             : /* }}} */
     353             : 
     354             : 
     355             : /* {{{ _mysqlnd_vio_set_methods */
     356             : static void
     357           0 : _mysqlnd_vio_set_methods(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_vio) * methods)
     358             : {
     359           0 :         MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_vio) = *methods;
     360           0 : }
     361             : /* }}} */
     362             : 
     363             : 
     364             : /* {{{ mysqlnd_command_factory_get */
     365             : static func_mysqlnd__command_factory
     366        1739 : _mysqlnd_command_factory_get()
     367             : {
     368        1739 :         return mysqlnd_command_factory;
     369             : }
     370             : /* }}} */
     371             : 
     372             : 
     373             : /* {{{ mysqlnd_command_factory_set */
     374             : static void
     375           0 : _mysqlnd_command_factory_set(func_mysqlnd__command_factory factory)
     376             : {
     377           0 :         mysqlnd_command_factory = factory;
     378           0 : }
     379             : /* }}} */
     380             : 
     381             : 
     382             : /* {{{ _mysqlnd_error_info_get_methods */
     383             : static MYSQLND_CLASS_METHODS_TYPE(mysqlnd_error_info) *
     384        9325 : _mysqlnd_error_info_get_methods()
     385             : {
     386        9325 :         return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_error_info);
     387             : }
     388             : /* }}} */
     389             : 
     390             : 
     391             : /* {{{ _mysqlnd_error_info_set_methods */
     392             : static void
     393           0 : _mysqlnd_error_info_set_methods(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_error_info) *methods)
     394             : {
     395           0 :         MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_error_info) = *methods;
     396           0 : }
     397             : /* }}} */
     398             : 
     399             : 
     400             : struct st_mysqlnd_plugin_methods_xetters mysqlnd_plugin_methods_xetters =
     401             : {
     402             :         {
     403             :                 _mysqlnd_object_factory_get_methods,
     404             :                 _mysqlnd_object_factory_set_methods
     405             :         },
     406             :         {
     407             :                 _mysqlnd_conn_get_methods,
     408             :                 _mysqlnd_conn_set_methods,
     409             :         },
     410             :         {
     411             :                 _mysqlnd_conn_data_get_methods,
     412             :                 _mysqlnd_conn_data_set_methods,
     413             :         },
     414             :         {
     415             :                 _mysqlnd_result_get_methods,
     416             :                 _mysqlnd_result_set_methods,
     417             :         },
     418             :         {
     419             :                 _mysqlnd_result_unbuffered_get_methods,
     420             :                 _mysqlnd_result_unbuffered_set_methods,
     421             :         },
     422             :         {
     423             :                 _mysqlnd_result_buffered_get_methods,
     424             :                 _mysqlnd_result_buffered_set_methods,
     425             :         },
     426             :         {
     427             :                 _mysqlnd_stmt_get_methods,
     428             :                 _mysqlnd_stmt_set_methods,
     429             :         },
     430             :         {
     431             :                 _mysqlnd_protocol_payload_decoder_factory_get_methods,
     432             :                 _mysqlnd_protocol_payload_decoder_factory_set_methods,
     433             :         },
     434             :         {
     435             :                 _mysqlnd_pfc_get_methods,
     436             :                 _mysqlnd_pfc_set_methods,
     437             :         },
     438             :         {
     439             :                 _mysqlnd_vio_get_methods,
     440             :                 _mysqlnd_vio_set_methods,
     441             :         },
     442             :         {
     443             :                 _mysqlnd_error_info_get_methods,
     444             :                 _mysqlnd_error_info_set_methods,
     445             :         },
     446             :         {
     447             :                 _mysqlnd_command_factory_get,
     448             :                 _mysqlnd_command_factory_set,
     449             :         },
     450             : };
     451             : 
     452             : /*
     453             :  * Local variables:
     454             :  * tab-width: 4
     455             :  * c-basic-offset: 4
     456             :  * End:
     457             :  * vim600: noet sw=4 ts=4 fdm=marker
     458             :  * vim<600: noet sw=4 ts=4
     459             :  */

Generated by: LCOV version 1.10

Generated at Wed, 24 Aug 2016 12:20:24 +0000 (2 days ago)

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