Hello Wez,
SQLite only throws exceptions from constructors. This is necessary to get
the "constructor failed" information. It works using the support functions
from main/main.c/main/php.h:
typedef enum {
EH_NORMAL = 0,
EH_SUPPRESS,
EH_THROW
} error_handling_t;
PHPAPI void php_set_error_handling(error_handling_t error_handling, zend_class_entry
*exception_class TSRMLS_DC);
#define php_std_error_handling() php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC)
php_set_error_handling(() sets the mode and class_entry.
php_std_error_handling() resets the mode and class entry.
EH_NORMAL => Standard behavior = no exceptions
EH_SUPPRESS => Neither throw an exception nor show/log the error
EH_THROW => Throw an exception if no excpetion is pending
If exception_class == NULL then a standard exception will be
generated.
Monday, April 12, 2004, 11:31:46 PM, you wrote:
> Note that sqlite does have an option to raise exceptions instead of errors.
> I haven't tried this myself; Marcus will be able to advise more on how this
> works.
> --Wez.
>> try {
>> $db = new SQLiteDatabase('foo.db');
>> if ($db->query($sql)) {
>> // fetch rows
>> } else {
>> // handle error
>> }
>> } catch {
>> // handle exception
>> }
>>
>> It's really crazy to need to mix both types of error handling within
>> the same block of code.
--
Best regards,
Marcus mailto:[EMAIL PROTECTED]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php