[ Index ] |
|
Code source de SPIP Agora 1.4 |
1 <?php 2 3 /** 4 * Local error callback handler. 5 * 6 * Drops the phptest table, prints out an error message and kills the 7 * process. 8 * 9 * @param object $o PEAR error object automatically passed to this method 10 * @return void 11 * @see PEAR::setErrorHandling() 12 */ 13 function pe($o) { 14 global $dbh; 15 16 $dbh->setErrorHandling(PEAR_ERROR_RETURN); 17 $dbh->query('DROP TABLE phptest'); 18 19 die($o->toString()); 20 } 21 22 $dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe'); 23 24 25 $sth = $dbh->simpleQuery("SELECT * FROM phptest"); 26 27 switch ($dbh->phptype) { 28 case 'mysqli': 29 if (is_a($sth, 'mysqli_result')) { 30 print "passed\n"; 31 } else { 32 print "PROBLEM\n"; 33 } 34 break; 35 default: 36 if (gettype($sth) == 'resource') { 37 print "passed\n"; 38 } else { 39 print "PROBLEM\n"; 40 } 41 } 42 43 44 switch ($dbh->phptype) { 45 case 'ibase': 46 /* 47 * Interbase doesn't allow dropping tables that have result 48 * sets still open. 49 */ 50 $dbh->freeResult($sth); 51 break; 52 } 53 $dbh->setErrorHandling(PEAR_ERROR_RETURN); 54 $dbh->query('DROP TABLE phptest'); 55 56 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 14:40:03 2007 | par Balluche grâce à PHPXref 0.7 |