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

Generated by: LTP GCOV extension version 1.5

Generated at Sat, 21 Nov 2009 12:27:02 +0000 (3 days ago)

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