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_exception.c
Test: PHP Code Coverage
Date: 2009-11-23 Instrumented lines: 18
Code covered: 94.4 % Executed lines: 17
Legend: not executed executed

       1                 : /*
       2                 :   +----------------------------------------------------------------------+
       3                 :   | PHP Version 6                                                        |
       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                 :   | Authors: Georg Richter <georg@php.net>                               |
      16                 :   |          Andrey Hristov <andrey@php.net>                             |
      17                 :   |          Ulf Wendel <uw@php.net>                                     |
      18                 :   +----------------------------------------------------------------------+
      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_structs.h"
      31                 : #include "zend_exceptions.h"
      32                 : 
      33                 : /* {{{ mysqli_exception_methods[]
      34                 :  */
      35                 : const zend_function_entry mysqli_exception_methods[] = {
      36                 :         {NULL, NULL, NULL}
      37                 : };
      38                 : /* }}} */
      39                 : 
      40                 : void php_mysqli_throw_sql_exception(char *sqlstate, int errorno TSRMLS_DC, char *format, ...) 
      41              38 : {
      42                 :         zval    *sql_ex;
      43                 :         va_list arg;
      44                 :         char    *message;
      45                 : 
      46              38 :         va_start(arg, format); 
      47              38 :         vspprintf(&message, 0, format, arg);
      48              38 :         va_end(arg);;
      49                 : 
      50              38 :         if (!(MyG(report_mode) & MYSQLI_REPORT_STRICT)) {
      51              32 :                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "(%s/%d): %s", sqlstate, errorno, message);
      52              32 :                 efree(message);
      53              32 :                 return;
      54                 :         }
      55                 : 
      56               6 :         MAKE_STD_ZVAL(sql_ex);
      57               6 :         object_init_ex(sql_ex, mysqli_exception_class_entry);
      58                 : 
      59               6 :         if (message) {
      60               6 :                 zend_update_property_string(mysqli_exception_class_entry, sql_ex, "message", sizeof("message") - 1,
      61                 :                                                                         message TSRMLS_CC);
      62                 :         }
      63                 : 
      64               6 :         if (sqlstate) {
      65               6 :                 zend_update_property_string(mysqli_exception_class_entry, sql_ex, "sqlstate", sizeof("sqlstate") - 1,
      66                 :                                                                         sqlstate TSRMLS_CC);
      67                 :         } else {
      68               0 :                 zend_update_property_string(mysqli_exception_class_entry, sql_ex, "sqlstate", sizeof("sqlstate") - 1,
      69                 :                                                                         "00000" TSRMLS_CC);
      70                 :         }
      71                 : 
      72               6 :         efree(message);
      73               6 :         zend_update_property_long(mysqli_exception_class_entry, sql_ex, "code", sizeof("code") - 1, errorno TSRMLS_CC);
      74                 : 
      75               6 :         zend_throw_exception_object(sql_ex TSRMLS_CC);
      76                 : }
      77                 : 
      78                 : /*
      79                 :  * Local variables:
      80                 :  * tab-width: 4
      81                 :  * c-basic-offset: 4
      82                 :  * indent-tabs-mode: t
      83                 :  * End:
      84                 :  * vim600: noet sw=4 ts=4 fdm=marker
      85                 :  * vim<600: noet sw=4 ts=4
      86                 :  */

Generated by: LTP GCOV extension version 1.5

Generated at Mon, 23 Nov 2009 17:39:32 +0000 (33 hours ago)

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