* @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version $Id: numcols.inc 239211 2007-07-06 05:19:21Z aharvey $ * @link http://pear.php.net/package/DB */ /** * Local error callback handler * * Drops the phptest table, prints out an error message and kills the * process. * * @param object $o PEAR error object automatically passed to this method * @return void * @see PEAR::setErrorHandling() */ function pe($o) { global $dbh; $dbh->setErrorHandling(PEAR_ERROR_RETURN); drop_table($dbh, 'phptest'); die($o->toString()); } $dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe'); $sth = $dbh->query("SELECT a FROM phptest"); printf("%d\n", $sth->numCols()); $sth = $dbh->query("SELECT a,b FROM phptest"); printf("%d\n", $sth->numCols()); $sth = $dbh->query("SELECT a,b,cc FROM phptest"); printf("%d\n", $sth->numCols()); $sth = $dbh->query("SELECT * FROM phptest"); printf("%d\n", $sth->numCols()); switch ($dbh->phptype) { case 'ibase': /* * Interbase doesn't allow dropping tables that have result * sets still open. */ $dbh->freeResult($sth->result); break; } $dbh->setErrorHandling(PEAR_ERROR_RETURN); drop_table($dbh, 'phptest');