mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Drop php_pdo_get_exception_base() function
This API is more confusing than helpful.
This commit is contained in:
parent
33028bf014
commit
898bb97706
@ -70,15 +70,6 @@ PDO_API char *php_pdo_str_tolower_dup(const char *src, int len) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
PDO_API zend_class_entry *php_pdo_get_exception_base(int root) /* {{{ */
|
||||
{
|
||||
if (!root) {
|
||||
return spl_ce_RuntimeException;
|
||||
}
|
||||
return zend_ce_exception;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ Return array of available PDO drivers */
|
||||
PHP_FUNCTION(pdo_drivers)
|
||||
{
|
||||
@ -315,7 +306,7 @@ PHP_MINIT_FUNCTION(pdo)
|
||||
|
||||
INIT_CLASS_ENTRY(ce, "PDOException", NULL);
|
||||
|
||||
pdo_exception_ce = zend_register_internal_class_ex(&ce, php_pdo_get_exception_base(0));
|
||||
pdo_exception_ce = zend_register_internal_class_ex(&ce, spl_ce_RuntimeException);
|
||||
|
||||
zend_declare_property_null(pdo_exception_ce, "errorInfo", sizeof("errorInfo")-1, ZEND_ACC_PUBLIC);
|
||||
|
||||
|
@ -100,12 +100,12 @@ void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate
|
||||
php_error_docref(NULL, E_WARNING, "%s", message);
|
||||
} else {
|
||||
zval ex, info;
|
||||
zend_class_entry *def_ex = php_pdo_get_exception_base(1), *pdo_ex = php_pdo_get_exception();
|
||||
zend_class_entry *pdo_ex = php_pdo_get_exception();
|
||||
|
||||
object_init_ex(&ex, pdo_ex);
|
||||
|
||||
zend_update_property_string(def_ex, Z_OBJ(ex), "message", sizeof("message")-1, message);
|
||||
zend_update_property_string(def_ex, Z_OBJ(ex), "code", sizeof("code")-1, *pdo_err);
|
||||
zend_update_property_string(zend_ce_exception, Z_OBJ(ex), "message", sizeof("message")-1, message);
|
||||
zend_update_property_string(zend_ce_exception, Z_OBJ(ex), "code", sizeof("code")-1, *pdo_err);
|
||||
|
||||
array_init(&info);
|
||||
|
||||
@ -175,12 +175,12 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt) /* {{{ */
|
||||
php_error_docref(NULL, E_WARNING, "%s", ZSTR_VAL(message));
|
||||
} else if (EG(exception) == NULL) {
|
||||
zval ex;
|
||||
zend_class_entry *def_ex = php_pdo_get_exception_base(1), *pdo_ex = php_pdo_get_exception();
|
||||
zend_class_entry *pdo_ex = php_pdo_get_exception();
|
||||
|
||||
object_init_ex(&ex, pdo_ex);
|
||||
|
||||
zend_update_property_str(def_ex, Z_OBJ(ex), "message", sizeof("message") - 1, message);
|
||||
zend_update_property_string(def_ex, Z_OBJ(ex), "code", sizeof("code") - 1, *pdo_err);
|
||||
zend_update_property_str(zend_ce_exception, Z_OBJ(ex), "message", sizeof("message") - 1, message);
|
||||
zend_update_property_string(zend_ce_exception, Z_OBJ(ex), "code", sizeof("code") - 1, *pdo_err);
|
||||
|
||||
if (!Z_ISUNDEF(info)) {
|
||||
zend_update_property(pdo_ex, Z_OBJ(ex), "errorInfo", sizeof("errorInfo") - 1, &info);
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
extern HashTable pdo_driver_hash;
|
||||
extern zend_class_entry *pdo_exception_ce;
|
||||
PDO_API zend_class_entry *php_pdo_get_exception_base(int root);
|
||||
int php_pdo_list_entry(void);
|
||||
|
||||
void pdo_dbh_init(void);
|
||||
|
Loading…
Reference in New Issue
Block a user