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

Generated by: LCOV version 1.10

Generated at Wed, 04 May 2016 01:00:52 +0000 (2 days ago)

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