helly Sun Oct 2 16:38:20 2005 EDT
Modified files: (Branch: PHP_5_1)
/php-src/ext/pdo pdo.c pdo_dbh.c php_pdo.h php_pdo_int.h
Log:
- MFH PDOException base
http://cvs.php.net/diff.php/php-src/ext/pdo/pdo.c?r1=1.57.2.7&r2=1.57.2.8&ty=u
Index: php-src/ext/pdo/pdo.c
diff -u php-src/ext/pdo/pdo.c:1.57.2.7 php-src/ext/pdo/pdo.c:1.57.2.8
--- php-src/ext/pdo/pdo.c:1.57.2.7 Mon Sep 19 20:35:20 2005
+++ php-src/ext/pdo/pdo.c Sun Oct 2 16:38:18 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo.c,v 1.57.2.7 2005/09/20 00:35:20 iliaa Exp $ */
+/* $Id: pdo.c,v 1.57.2.8 2005/10/02 20:38:18 helly Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -60,10 +60,42 @@
return pdo_exception_ce;
}
+PDO_API zend_class_entry *php_pdo_get_exception_base(int root TSRMLS_DC)
+{
+#if can_handle_soft_dependency_on_SPL && defined(HAVE_SPL) &&
((PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1))
+ if (!root) {
+ return spl_ce_RuntimeException;
+ }
+#endif
+#if (PHP_MAJOR_VERSION < 6)
+ return zend_exception_get_default();
+#else
+ return zend_exception_get_default(TSRMLS_C);
+#endif
+}
+
zend_class_entry *pdo_dbh_ce, *pdo_dbstmt_ce, *pdo_row_ce;
+/* proto array pdo_drivers()
+ Return array of available PDO drivers */
+PHP_FUNCTION(pdo_drivers)
+{
+ HashPosition pos;
+ pdo_driver_t **pdriver;
+
+ array_init(return_value);
+
+ zend_hash_internal_pointer_reset_ex(&pdo_driver_hash, &pos);
+ while (SUCCESS == zend_hash_get_current_data_ex(&pdo_driver_hash,
(void**)&pdriver, &pos)) {
+ add_next_index_stringl(return_value,
(char*)(*pdriver)->driver_name, (*pdriver)->driver_name_len, 1);
+ zend_hash_move_forward_ex(&pdo_driver_hash, &pos);
+ }
+}
+/* }}} */
+
/* {{{ pdo_functions[] */
function_entry pdo_functions[] = {
+ PHP_FE(pdo_drivers, NULL)
{NULL, NULL, NULL}
};
/* }}} */
http://cvs.php.net/diff.php/php-src/ext/pdo/pdo_dbh.c?r1=1.82.2.6&r2=1.82.2.7&ty=u
Index: php-src/ext/pdo/pdo_dbh.c
diff -u php-src/ext/pdo/pdo_dbh.c:1.82.2.6 php-src/ext/pdo/pdo_dbh.c:1.82.2.7
--- php-src/ext/pdo/pdo_dbh.c:1.82.2.6 Sun Oct 2 16:07:11 2005
+++ php-src/ext/pdo/pdo_dbh.c Sun Oct 2 16:38:18 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_dbh.c,v 1.82.2.6 2005/10/02 20:07:11 helly Exp $ */
+/* $Id: pdo_dbh.c,v 1.82.2.7 2005/10/02 20:38:18 helly Exp $ */
/* The PDO Database Handle Class */
@@ -84,7 +84,7 @@
}
} else {
zval *ex;
- zend_class_entry *def_ex = zend_exception_get_default(),
*pdo_ex = php_pdo_get_exception();
+ zend_class_entry *def_ex = php_pdo_get_exception_base(1
TSRMLS_CC), *pdo_ex = php_pdo_get_exception();
MAKE_STD_ZVAL(ex);
object_init_ex(ex, pdo_ex);
@@ -165,7 +165,7 @@
}
} else if (EG(exception) == NULL) {
zval *ex;
- zend_class_entry *def_ex = zend_exception_get_default(),
*pdo_ex = php_pdo_get_exception();
+ zend_class_entry *def_ex = php_pdo_get_exception_base(1
TSRMLS_CC), *pdo_ex = php_pdo_get_exception();
MAKE_STD_ZVAL(ex);
object_init_ex(ex, pdo_ex);
@@ -1074,7 +1074,6 @@
}
/* }}} */
-
function_entry pdo_dbh_functions[] = {
ZEND_MALIAS(PDO, __construct, dbh_constructor, NULL,
ZEND_ACC_PUBLIC)
PHP_ME(PDO, prepare, NULL,
ZEND_ACC_PUBLIC)
@@ -1348,6 +1347,10 @@
pefree(dbh->password, dbh->is_persistent);
}
+ if (dbh->def_stmt_ctor_args) {
+ zval_ptr_dtor(&dbh->def_stmt_ctor_args);
+ }
+
pefree(dbh, dbh->is_persistent);
}
http://cvs.php.net/diff.php/php-src/ext/pdo/php_pdo.h?r1=1.7.2.3&r2=1.7.2.4&ty=u
Index: php-src/ext/pdo/php_pdo.h
diff -u php-src/ext/pdo/php_pdo.h:1.7.2.3 php-src/ext/pdo/php_pdo.h:1.7.2.4
--- php-src/ext/pdo/php_pdo.h:1.7.2.3 Fri Sep 30 22:48:11 2005
+++ php-src/ext/pdo/php_pdo.h Sun Oct 2 16:38:18 2005
@@ -16,13 +16,17 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo.h,v 1.7.2.3 2005/10/01 02:48:11 wez Exp $ */
+/* $Id: php_pdo.h,v 1.7.2.4 2005/10/02 20:38:18 helly Exp $ */
#ifndef PHP_PDO_H
#define PHP_PDO_H
#include "zend.h"
+#if PHP_MAJOR_VERSION > 5 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1)
+#define can_handle_soft_dependency_on_SPL 1
+#endif
+
extern zend_module_entry pdo_module_entry;
#define phpext_pdo_ptr &pdo_module_entry
http://cvs.php.net/diff.php/php-src/ext/pdo/php_pdo_int.h?r1=1.17.2.2&r2=1.17.2.3&ty=u
Index: php-src/ext/pdo/php_pdo_int.h
diff -u php-src/ext/pdo/php_pdo_int.h:1.17.2.2
php-src/ext/pdo/php_pdo_int.h:1.17.2.3
--- php-src/ext/pdo/php_pdo_int.h:1.17.2.2 Sat Sep 24 10:18:01 2005
+++ php-src/ext/pdo/php_pdo_int.h Sun Oct 2 16:38:18 2005
@@ -18,13 +18,14 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_int.h,v 1.17.2.2 2005/09/24 14:18:01 edink Exp $ */
+/* $Id: php_pdo_int.h,v 1.17.2.3 2005/10/02 20:38:18 helly Exp $ */
/* Stuff private to the PDO extension and not for consumption by PDO drivers
* */
extern HashTable pdo_driver_hash;
extern zend_class_entry *pdo_exception_ce;
+PDO_API zend_class_entry *php_pdo_get_exception_base(int root TSRMLS_DC);
int php_pdo_list_entry(void);
void pdo_dbh_init(TSRMLS_D);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php