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_report.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 "php.h"
26 : #include "php_ini.h"
27 : #include "ext/standard/info.h"
28 : #include "php_mysqli.h"
29 :
30 : /* {{{ proto bool mysqli_report(int flags)
31 : sets report level */
32 : PHP_FUNCTION(mysqli_report)
33 0 : {
34 : long flags;
35 :
36 :
37 0 : if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
38 0 : return;
39 : }
40 :
41 0 : MyG(report_mode) = flags;
42 :
43 0 : RETURN_TRUE;
44 : }
45 : /* }}} */
46 :
47 : /* {{{ void php_mysqli_report_error(char *sqlstate, int errorno, char *error) */
48 0 : void php_mysqli_report_error(char *sqlstate, int errorno, char *error TSRMLS_DC) {
49 0 : php_mysqli_throw_sql_exception(sqlstate, errorno TSRMLS_CC, "%s", error);
50 0 : }
51 : /* }}} */
52 :
53 : /* {{{ void php_mysqli_report_index() */
54 0 : void php_mysqli_report_index(char *query, unsigned int status TSRMLS_DC) {
55 : char index[15];
56 :
57 0 : if (status & SERVER_QUERY_NO_GOOD_INDEX_USED) {
58 0 : strcpy(index, "Bad index");
59 0 : } else if (status & SERVER_QUERY_NO_INDEX_USED) {
60 0 : strcpy(index, "No index");
61 : } else {
62 0 : return;
63 : }
64 0 : php_mysqli_throw_sql_exception("00000", 0 TSRMLS_CC, "%s used in query/prepared statement %s", index, query);
65 : }
66 : /* }}} */
67 :
68 : /*
69 : * Local variables:
70 : * tab-width: 4
71 : * c-basic-offset: 4
72 : * End:
73 : * vim600: noet sw=4 ts=4 fdm=marker
74 : * vim<600: noet sw=4 ts=4
75 : */
|