svn: /pecl/mysqlnd_ms/trunk/ mysqlnd_ms.c tests/mysqlnd_ms_gtid_ps_report_errors_on.phpt
| From: | Ulf Wendel | Date: | Thu, 08 Dec 2011 15:02:23 +0000 |
| Subject: | svn: /pecl/mysqlnd_ms/trunk/ mysqlnd_ms.c tests/mysqlnd_ms_gtid_ps_report_errors_on.phpt | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-17328@lists.php.net to get a copy of this message | ||
uw Thu, 08 Dec 2011 15:02:23 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=320665
Log:
Copy error from conn to stmt. The user gets a failure from stmt handle and shall see the error
message on stmt handle. Not sure if we should clear error on conn. It can't harm to have it set
on conn as well.
Changed paths:
U pecl/mysqlnd_ms/trunk/mysqlnd_ms.c
U pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_gtid_ps_report_errors_on.phpt
Modified: pecl/mysqlnd_ms/trunk/mysqlnd_ms.c
===================================================================
--- pecl/mysqlnd_ms/trunk/mysqlnd_ms.c 2011-12-08 14:57:02 UTC (rev 320664)
+++ pecl/mysqlnd_ms/trunk/mysqlnd_ms.c 2011-12-08 15:02:23 UTC (rev 320665)
@@ -528,7 +528,7 @@
tmp_conn_handle->m->dtor(tmp_conn_handle TSRMLS_CC);
}
#endif
-
+
} else {
failures++;
/* Handle OOM!! */
@@ -1864,10 +1864,12 @@
enum_func_status ret = PASS;
MYSQLND_MS_CONN_DATA ** conn_data = NULL;
MYSQLND_CONN_DATA * connection = NULL;
+ MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
DBG_ENTER("mysqlnd_ms_stmt::execute");
- if (!s || !s->data || !s->data->conn ||
+ if (!stmt ||
+ !s || !s->data || !s->data->conn ||
!(MS_LOAD_CONN_DATA(conn_data, s->data->conn)) ||
!conn_data || !*conn_data || (*conn_data)->skip_ms_calls)
{
@@ -1886,12 +1888,14 @@
MYSQLND_MS_INC_STATISTIC((PASS == ret) ? MS_STAT_GTID_AUTOCOMMIT_SUCCESS :
MS_STAT_GTID_AUTOCOMMIT_FAILURE);
if (FAIL == ret) {
- /* TODO: copy to stmt error? */
if (TRUE == (*conn_data)->global_trx.report_error) {
+ /* user stmt returns false and shall have error set */
+ SET_STMT_ERROR(stmt,
+ (MYSQLND_MS_ERROR_INFO(connection)).error_no,
+ (MYSQLND_MS_ERROR_INFO(connection)).sqlstate,
+ (MYSQLND_MS_ERROR_INFO(connection)).error);
DBG_RETURN(ret);
}
-
- /* TODO: clear stmt error? */
SET_EMPTY_ERROR(MYSQLND_MS_ERROR_INFO(connection));
}
}
Modified: pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_gtid_ps_report_errors_on.phpt
===================================================================
--- pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_gtid_ps_report_errors_on.phpt 2011-12-08 14:57:02 UTC
(rev 320664)
+++ pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_gtid_ps_report_errors_on.phpt 2011-12-08 15:02:23 UTC
(rev 320665)
@@ -138,5 +138,5 @@
?>
--EXPECTF--
[010] [1146] %s
-[011] [0%A
+[011] [1146] %s
done!
\ No newline at end of file