Re: Is raiseError 4.0.5 specific?
| From: | (Stig Sæther Bakken) | Date: | Mon, 21 May 2001 09:00:32 +0000 |
| Subject: | Re: Is raiseError 4.0.5 specific? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-410@lists.php.net to get a copy of this message | ||
PEAR::raiseError was added in 4.0.5. Before that only DB had this
functionality.
- Stig
[Robert Kelly <rkelly@Insight.com>]
> I am currently working with 4.0.4 in DB/odbc.php.
>
> // my code, my file
> if (! PEAR::isError ( $db = DB::connect( $DSN ) ) ) {
> print_r ( $db ); // returns an db_odbc object
>
> DB/odbc.php Line 122 fails to connect to the odbc (testing PEAR_Error)
> 122 $conn = $connect_function ("foo", "bar", "foobar" );
> 123 if ( ! is_resource ( $conn ) ) {
> 124 return $this->raiseError... // a print_R reveals
> $this->raiseError is an error
>
>
> if you track this down,
> PEAR.php
> 238 returns a PEAR_Error to the $this->raiseError call on odbc.php line
> 1
>
>
> $this->raiseError returns a PEAR_Error object
>
> but
>
> return $this->raiseError(); returns db_odbc object
>
> Has the return function changed some how between 4.0.5. and 4.0.4? Am I on
> drugs here?
>
> -Bob Kelly
> -rkelly@insight.com
>
> test file included:
> <?php
>
> echo "<pre>";
>
> echo "<b>Require DB.php</b> \n";
> require_once( 'DB.php' );
> echo "\n";
>
> echo "<b>Create new PEAR DB object</b> with DSN string:\n";
> $DSN = "odbc://foo:bar@test1/baddata";
>
> echo $DSN . "\n";
> if (! PEAR::isError ( $db = DB::connect( $DSN ) ) ) {
> echo "<b>DB connection</b> is Good\n";
> echo "\n";
>
> echo "<b>DB object</b> \n";
> print_r ( $db );
> echo "\n";
>
> echo "<b>DB result test</b>\n";
> #$result = $db->query("INSERT TEST QUERY HERE");
> echo "\n";
>
>
> echo "<b>DB result </b> results\n";
> print_r ( $result);
> echo "\n";
>
> echo "<b>DB disconnect </b> \n";
> $db->disconnect();
> echo "\n";
>
> } else {
> echo "<b>ERROR</b>::DB connection is BAD\n";
> print_R ( $db );
> }
> ?>
>
>
--
Stig Sæther Bakken <ssb@fast.no>
Fast Search & Transfer ASA, Trondheim, Norway