On April 12, 2004 11:42 am, Adam Maccabee Trachtenberg wrote:
> As to E_WARNINGs, what to do? Sometimes they can be safely ignored,
> but it takes an experienced programmer to know those cases.

Perhaps, but if you limit the experienced programmer's options and/or make 
using more advanced capabilities of the language more difficult you will lose 
those programmers to other languages. Consequently these programmers are 
usually the ones responsible for large deployments of the language.

> So you're saying you write code like:
>
> // Don't care if this prints anything:
> $db = new SQLiteDatabase('foo.db');
> $r = $db->query($sql);
> foreach ($r as $row) {
>   processRow($row);
> }

Almost ;-)
$r = $db->query($sql) or sql_error_handler($sql, $db);

It'll be the job of sql_error_handler() to determine what type of an error had 
occurred and what action to take if any.

> FWIW, I just checked, and Java handles this dilemma in JDBC by *not*
> throwing exceptions upon SQL warnings. They still throw SQLExceptions
> for major DB errors.

Well, that would mean that you'll never be certain what may throw an 
exceptions giving you a nasty mix of both that will confuse experienced and 
inexperienced developers alike.

Ilia

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to