Login   Register  
PHP Classes
elePHPant
Icontem

File: docs/errors.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Temperini Mirko  >  APIQL  >  docs/errors.php  >  Download  
File: docs/errors.php
Role: Documentation
Content type: text/plain
Description: Configuring class error reporting
Class: APIQL
Define and run commands of a data query language
Author: By
Last change:
Date: 2011-09-03 10:43
Size: 2,563 bytes
 

Contents

Class file image Download
<?php 
include 'functions.php';

html_header('Errors configuration');

?>
There are 3 variables dedicated to the errors in the class, and you can access on them using 2 methods:
<br /><br>
<i>apiql::set()</i><br> 
<i>apiql::get()</i>
<br />
<br>
<br>
<b>Configuring</b>
<br><br>
<ul>
    <li>
        <i><b>check_func_exists</b></i><br>BOOLEAN DEFAULT false<br>
        Checks or not if a function exists BEFORE it is binded to query
    </li>
    <li>
        <i><b>display_errors</b></i><br>BOOLEAN DEFAULT true<br>
        If the error will be printed out or not
    </li>
    <li>
        <i><b>error_level</b></i><br>INT DEFAULT <?php echo E_USER_WARNING ?><br>
        The level of the error will be generated. it works according on the PHP constants dedicated to error levels.<br>
        For better info see <a href="http://it.php.net/manual/en/errorfunc.constants.php" target="_blank">http://it.php.net/manual/en/errorfunc.constants.php</a>
    </li>
</ul>
<br><br><br>
<?php showcode("
apiql::set('check_func_exists',true);
apiql::set('display_errors',false);
apiql::set('error_level',E_USER_ERROR); 

echo apiql::get('check_func_exists'); //returns true
echo apiql::get('display_errors'); //returns false
echo apiql::get('error_level'); //returns 256

");
?>
<hr />
<?php 
/***************************************************************/

showcode("//default settings for errors
apiql::query('a fake query');");
config_table();

apiql::query('a fake query');

/***************************************************************/

echo '<hr/>';
apiql::set('check_func_exists',true);

showcode("apiql::set('check_func_exists',true);
apiql::register('my/fake/query','barfoo');");
config_table();

apiql::register('!my/!fake/!query','barfoo');

/***************************************************************/

echo '<hr/>';
apiql::set('check_func_exists',true);
apiql::set('display_errors',false);

showcode("apiql::set('check_func_exists',true);
apiql::set('display_errors',false);
apiql::register('my/fake/query','barfoo');");
config_table();

apiql::register('!my/!fake/!query','barfoo');

/***************************************************************/

apiql::set('display_errors',true);

echo '<hr/>';
apiql::set('error_level',E_USER_NOTICE);

showcode("apiql::set('display_errors',true);
apiql::set('error_level',E_USER_NOTICE);
apiql::register('my/fake/query','barfoo');");
config_table();

apiql::register('!my/!fake/!query','barfoo');

html_footer();
?>