Documentation is available at set_error_handler.php
- <?php
- /**
- * SetErrorHandler Example
- *
- * This example show how to set an error handler for AbstractDB.
- * @package AbstractDB
- * @author Pacific-Cybersoft
- * @copyright (C) 2005 Pacific-Cybersoft. All Rights Reserved.
- * @version v 1.0.2
- * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
- */
- /**
- * Include the AbstractDB main class.
- */
- include("../abstractdb.class.php");
- function ExampleErrorHandler($source, $error)
- {
- // Do something with the info.
- // $source will be a copy of the AbstractDB object.
- print_r($source);
- // $error will be an associative array containing error scope and message.
- echo($error["Scope"] . " - " . $error["Message"]);
- }
- // Instatiate AbstractDB
- $db = new AbstractDB(array("ConnectionString"=>"mysql://username:password@localhost/mydatabase"));
- // Set the error handler
- $db->SetErrorHandler("ExampleErrorHandler") or die($db->GetLastError());
- // Now if we execute a bad query or whenever an error occurs, ExampleErrorHandler will be called.
- $db->Query("SELECT NonExistentColumn from BadTableName");
- // Always good practice to close AbstractDB at the end of each script.
- $db->Close();
- ?>
Documentation generated on Wed, 16 Mar 2005 23:17:29 +1100 by phpDocumentor 1.3.0RC3