wez Sun Sep 11 01:08:50 2005 EDT
Modified files:
/php-src/ext/pdo_mysql mysql_driver.c
/php-src/ext/pdo_oci oci_driver.c
/php-src/ext/pdo_pgsql pgsql_statement.c
/php-src/ext/pdo_sqlite sqlite_driver.c
Log:
merge other PDO fixes from 5.1 branch.
Allow pdo_sqlite to build against 5.0 and 5.1 too.
http://cvs.php.net/diff.php/php-src/ext/pdo_mysql/mysql_driver.c?r1=1.63&r2=1.64&ty=u
Index: php-src/ext/pdo_mysql/mysql_driver.c
diff -u php-src/ext/pdo_mysql/mysql_driver.c:1.63
php-src/ext/pdo_mysql/mysql_driver.c:1.64
--- php-src/ext/pdo_mysql/mysql_driver.c:1.63 Tue Aug 30 23:48:01 2005
+++ php-src/ext/pdo_mysql/mysql_driver.c Sun Sep 11 01:08:47 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mysql_driver.c,v 1.63 2005/08/31 03:48:01 gschlossnagle Exp $ */
+/* $Id: mysql_driver.c,v 1.64 2005/09/11 05:08:47 wez Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -424,7 +424,7 @@
}
dbname = vars[1].optval;
- host = vars[2].optval;
+ host = vars[2].optval;
if(vars[3].optval) {
port = atoi(vars[3].optval);
}
http://cvs.php.net/diff.php/php-src/ext/pdo_oci/oci_driver.c?r1=1.26&r2=1.27&ty=u
Index: php-src/ext/pdo_oci/oci_driver.c
diff -u php-src/ext/pdo_oci/oci_driver.c:1.26
php-src/ext/pdo_oci/oci_driver.c:1.27
--- php-src/ext/pdo_oci/oci_driver.c:1.26 Tue Aug 30 15:59:11 2005
+++ php-src/ext/pdo_oci/oci_driver.c Sun Sep 11 01:08:49 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci_driver.c,v 1.26 2005/08/30 19:59:11 gschlossnagle Exp $ */
+/* $Id: oci_driver.c,v 1.27 2005/09/11 05:08:49 wez Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -144,6 +144,18 @@
}
}
+ if (stmt) {
+ /* always propogate the error code back up to the dbh,
+ * so that we can catch the error information when execute
+ * is called via query. See Bug #33707 */
+ if (H->einfo.errmsg) {
+ efree(H->einfo.errmsg);
+ }
+ H->einfo = *einfo;
+ H->einfo.errmsg = einfo->errmsg ? estrdup(einfo->errmsg) : NULL;
+ strcpy(dbh->error_code, stmt->error_code);
+ }
+
/* little mini hack so that we can use this code from the dbh ctor */
if (!dbh->methods) {
zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0
TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg);
http://cvs.php.net/diff.php/php-src/ext/pdo_pgsql/pgsql_statement.c?r1=1.32&r2=1.33&ty=u
Index: php-src/ext/pdo_pgsql/pgsql_statement.c
diff -u php-src/ext/pdo_pgsql/pgsql_statement.c:1.32
php-src/ext/pdo_pgsql/pgsql_statement.c:1.33
--- php-src/ext/pdo_pgsql/pgsql_statement.c:1.32 Sat Sep 3 19:52:56 2005
+++ php-src/ext/pdo_pgsql/pgsql_statement.c Sun Sep 11 01:08:49 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql_statement.c,v 1.32 2005/09/03 23:52:56 edink Exp $ */
+/* $Id: pgsql_statement.c,v 1.33 2005/09/11 05:08:49 wez Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -203,6 +203,10 @@
Z_TYPE_P(param->parameter) == IS_NULL) {
S->param_values[param->paramno]
= NULL;
S->param_lengths[param->paramno] = 0;
+ } else if (Z_TYPE_P(param->parameter)
== IS_BOOL) {
+ S->param_values[param->paramno]
= Z_BVAL_P(param->parameter) ? "t" : "f";
+
S->param_lengths[param->paramno] = 1;
+
S->param_formats[param->paramno] = 1;
} else {
convert_to_string(param->parameter);
S->param_values[param->paramno]
= Z_STRVAL_P(param->parameter);
http://cvs.php.net/diff.php/php-src/ext/pdo_sqlite/sqlite_driver.c?r1=1.22&r2=1.23&ty=u
Index: php-src/ext/pdo_sqlite/sqlite_driver.c
diff -u php-src/ext/pdo_sqlite/sqlite_driver.c:1.22
php-src/ext/pdo_sqlite/sqlite_driver.c:1.23
--- php-src/ext/pdo_sqlite/sqlite_driver.c:1.22 Mon Aug 22 08:22:11 2005
+++ php-src/ext/pdo_sqlite/sqlite_driver.c Sun Sep 11 01:08:49 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sqlite_driver.c,v 1.22 2005/08/22 12:22:11 dmitry Exp $ */
+/* $Id: sqlite_driver.c,v 1.23 2005/09/11 05:08:49 wez Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -457,7 +457,11 @@
char *func_name;
int func_name_len;
long argc = -1;
+#ifdef IS_UNICODE
zval cbname;
+#else
+ char *cbname;
+#endif
pdo_dbh_t *dbh;
pdo_sqlite_db_handle *H;
int ret;
@@ -470,11 +474,20 @@
dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
if (!zend_is_callable(callback, 0, &cbname)) {
+#ifdef IS_UNICODE
php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%R' is
not callable", Z_TYPE(cbname), Z_UNIVAL(cbname));
zval_dtor(&cbname);
+#else
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is
not callable", cbname);
+ efree(cbname);
+#endif
RETURN_FALSE;
}
+#ifdef IS_UNICODE
zval_dtor(&cbname);
+#else
+ efree(cbname);
+#endif
H = (pdo_sqlite_db_handle *)dbh->driver_data;
@@ -528,7 +541,11 @@
char *func_name;
int func_name_len;
long argc = -1;
+#ifdef IS_UNICODE
zval cbname;
+#else
+ char *cbname;
+#endif
pdo_dbh_t *dbh;
pdo_sqlite_db_handle *H;
int ret;
@@ -541,17 +558,35 @@
dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
if (!zend_is_callable(step_callback, 0, &cbname)) {
+#ifdef IS_UNICODE
php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%R' is
not callable", Z_TYPE(cbname), Z_UNIVAL(cbname));
zval_dtor(&cbname);
+#else
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is
not callable", cbname);
+ efree(cbname);
+#endif
RETURN_FALSE;
}
+#ifdef IS_UNICODE
zval_dtor(&cbname);
+#else
+ efree(cbname);
+#endif
if (!zend_is_callable(fini_callback, 0, &cbname)) {
+#ifdef IS_UNICODE
php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%R' is
not callable", Z_TYPE(cbname), Z_UNIVAL(cbname));
zval_dtor(&cbname);
+#else
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is
not callable", cbname);
+ efree(cbname);
+#endif
RETURN_FALSE;
}
+#ifdef IS_UNICODE
zval_dtor(&cbname);
+#else
+ efree(cbname);
+#endif
H = (pdo_sqlite_db_handle *)dbh->driver_data;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php