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

LTP GCOV extension - code coverage report
Current view: directory - mysqli - mysqli_repl.c
Test: PHP Code Coverage
Date: 2009-11-19 Instrumented lines: 65
Code covered: 0.0 % Executed lines: 0
Legend: not executed executed

       1                 : /*
       2                 :   +----------------------------------------------------------------------+
       3                 :   | PHP Version 5                                                        |
       4                 :   +----------------------------------------------------------------------+
       5                 :   | Copyright (c) 1997-2009 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                 :   $Id: mysqli_repl.c 272374 2008-12-31 11:17:49Z sebastian $
      19                 : */
      20                 : 
      21                 : #ifdef HAVE_CONFIG_H
      22                 : #include "config.h"
      23                 : #endif
      24                 : 
      25                 : #include <signal.h>
      26                 : 
      27                 : #include "php.h"
      28                 : #include "php_ini.h"
      29                 : #include "ext/standard/info.h"
      30                 : #include "php_mysqli.h"
      31                 : 
      32                 : #ifdef HAVE_LIBMYSQL_REPLICATION
      33                 : /* {{{ proto void mysqli_disable_reads_from_master(object link)
      34                 : */
      35                 : PHP_FUNCTION(mysqli_disable_reads_from_master)
      36               0 : {
      37                 :         MYSQL           *mysql;
      38                 :         zval            *mysql_link;
      39                 : 
      40               0 :         if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
      41               0 :                 return;
      42                 :         }
      43               0 :         MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
      44               0 :         mysql_disable_reads_from_master(mysql);
      45               0 :         RETURN_TRUE;
      46                 : }
      47                 : /* }}} */
      48                 : 
      49                 : /* {{{ proto void mysqli_disable_rpl_parse(object link)
      50                 : */
      51                 : PHP_FUNCTION(mysqli_disable_rpl_parse)
      52               0 : {
      53                 :         MYSQL           *mysql;
      54                 :         zval            *mysql_link;
      55                 : 
      56               0 :         if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
      57               0 :                 return;
      58                 :         }
      59               0 :         MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
      60               0 :         mysql_disable_rpl_parse(mysql);
      61               0 :         RETURN_TRUE;
      62                 : }
      63                 : /* }}} */
      64                 : 
      65                 : /* {{{ proto void mysqli_enable_reads_from_master(object link)
      66                 : */
      67                 : PHP_FUNCTION(mysqli_enable_reads_from_master)
      68               0 : {
      69                 :         MYSQL           *mysql;
      70                 :         zval            *mysql_link;
      71                 : 
      72               0 :         if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
      73               0 :                 return;
      74                 :         }
      75               0 :         MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
      76                 : 
      77               0 :         mysql_enable_reads_from_master(mysql);
      78               0 :         RETURN_TRUE;
      79                 : }
      80                 : /* }}} */
      81                 : 
      82                 : /* {{{ proto void mysqli_enable_rpl_parse(object link)
      83                 : */
      84                 : PHP_FUNCTION(mysqli_enable_rpl_parse)
      85               0 : {
      86                 :         MYSQL           *mysql;
      87                 :         zval            *mysql_link;
      88                 : 
      89               0 :         if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
      90               0 :                 return;
      91                 :         }
      92               0 :         MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
      93                 : 
      94               0 :         mysql_enable_rpl_parse(mysql);
      95               0 :         RETURN_TRUE;
      96                 : }
      97                 : /* }}} */
      98                 : 
      99                 : /* {{{ proto bool mysqli_master_query(object link, string query)
     100                 :    Enforce execution of a query on the master in a master/slave setup */
     101               0 : PHP_FUNCTION(mysqli_master_query) {
     102                 :         MYSQL                   *mysql;
     103                 :         zval                    *mysql_link;
     104               0 :         char                    *query = NULL;
     105                 :         unsigned int    query_len;
     106                 : 
     107               0 :         if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
     108               0 :                 return;
     109                 :         }
     110               0 :         MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
     111                 : 
     112               0 :         if (mysql_master_query(mysql, query, query_len)) {
     113               0 :                 RETURN_FALSE;
     114                 :         }       
     115               0 :         RETURN_TRUE;
     116                 : }
     117                 : /* }}} */
     118                 : 
     119                 : /* {{{ proto int mysqli_rpl_parse_enabled(object link)
     120                 : */
     121                 : PHP_FUNCTION(mysqli_rpl_parse_enabled)
     122               0 : {
     123                 :         MYSQL           *mysql;
     124                 :         zval            *mysql_link;
     125                 : 
     126               0 :         if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
     127               0 :                 return;
     128                 :         }
     129               0 :         MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
     130                 : 
     131               0 :         RETURN_LONG(mysql_rpl_parse_enabled(mysql));
     132                 : }
     133                 : /* }}} */
     134                 : 
     135                 : /* {{{ proto bool mysqli_rpl_probe(object link)
     136                 : */
     137                 : PHP_FUNCTION(mysqli_rpl_probe)
     138               0 : {
     139                 :         MYSQL           *mysql;
     140                 :         zval            *mysql_link;
     141                 : 
     142               0 :         if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
     143               0 :                 return;
     144                 :         }
     145               0 :         MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
     146                 : 
     147                 : 
     148               0 :         if (mysql_rpl_probe(mysql)) {
     149               0 :                 RETURN_FALSE;
     150                 :         }
     151               0 :         RETURN_TRUE;
     152                 : }
     153                 : /* }}} */
     154                 : 
     155                 : /* {{{ proto int mysqli_rpl_query_type(string query)
     156                 : */
     157                 : PHP_FUNCTION(mysqli_rpl_query_type)
     158               0 : {
     159                 :         MYSQL           *mysql;
     160                 :         zval            *mysql_link;
     161                 :         char            *query;
     162                 :         int                     query_len;
     163                 : 
     164               0 :         if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
     165               0 :                 return;
     166                 :         }
     167               0 :         MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
     168                 : 
     169               0 :         RETURN_LONG(mysql_rpl_query_type(query, query_len));
     170                 : }
     171                 : /* }}} */
     172                 : 
     173                 : /* {{{ proto bool mysqli_send_query(object link, string query)
     174                 : */
     175                 : PHP_FUNCTION(mysqli_send_query)
     176               0 : {
     177                 :         MYSQL                   *mysql;
     178                 :         zval                    *mysql_link;
     179               0 :         char                    *query = NULL;
     180                 :         unsigned int    query_len;
     181                 : 
     182               0 :         if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
     183               0 :                 return;
     184                 :         }
     185               0 :         MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
     186                 : 
     187               0 :         if (mysql_send_query(mysql, query, query_len)) {
     188               0 :                 RETURN_FALSE;
     189                 :         }       
     190               0 :         RETURN_TRUE;
     191                 : }
     192                 : /* }}} */
     193                 : 
     194                 : /* {{{ proto bool mysqli_slave_query(object link, string query)
     195                 :    Enforce execution of a query on a slave in a master/slave setup */
     196                 : PHP_FUNCTION(mysqli_slave_query)
     197               0 : {
     198                 :         MYSQL                   *mysql;
     199                 :         zval                    *mysql_link;
     200               0 :         char                    *query = NULL;
     201                 :         unsigned int    query_len;
     202                 : 
     203               0 :         if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
     204               0 :                 return;
     205                 :         }
     206               0 :         MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
     207                 : 
     208               0 :         if (mysql_slave_query(mysql, query, query_len)) {
     209               0 :                 RETURN_FALSE;
     210                 :         }       
     211               0 :         RETURN_TRUE;
     212                 : }
     213                 : /* }}} */
     214                 : 
     215                 : #endif /* HAVE_LIBMYSQL_REPLICATION */
     216                 : 
     217                 : /*
     218                 :  * Local variables:
     219                 :  * tab-width: 4
     220                 :  * c-basic-offset: 4
     221                 :  * End:
     222                 :  * vim600: noet sw=4 ts=4 fdm=marker
     223                 :  * vim<600: noet sw=4 ts=4
     224                 :  */

Generated by: LTP GCOV extension version 1.5

Generated at Thu, 19 Nov 2009 08:20:13 +0000 (5 days ago)

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