summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_loaddata.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2011-08-04 09:51:26 +0000
committerAndrey Hristov <andrey@php.net>2011-08-04 09:51:26 +0000
commit11f198b203a715ff4495b452e2ec10bc6f60baad (patch)
tree889f10e5b9ef36ae7095063428319327d5e16274 /ext/mysqlnd/mysqlnd_loaddata.c
parent463de70efd83274ba8df51a4b75a21c8e6382baa (diff)
downloadphp-git-11f198b203a715ff4495b452e2ec10bc6f60baad.tar.gz
Add mysqli_error_list() that returns an array with errors. Typically only
one and just one for libmysql. mysqlnd can return generate more than one error during its work and with mysqli_error() only the last error is being reported. In the array returned by mysqli_error_list() / $mysqli->error_list, all errors will be found. The list is reset when the next command is executed
Diffstat (limited to 'ext/mysqlnd/mysqlnd_loaddata.c')
-rw-r--r--ext/mysqlnd/mysqlnd_loaddata.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c
index e7803c8169..db7a9e7201 100644
--- a/ext/mysqlnd/mysqlnd_loaddata.c
+++ b/ext/mysqlnd/mysqlnd_loaddata.c
@@ -181,11 +181,12 @@ mysqlnd_handle_local_infile(MYSQLND *conn, const char *filename, zend_bool *is_w
/* init handler: allocate read buffer and open file */
if (infile.local_infile_init(&info, (char *)filename, conn->infile.userdata TSRMLS_CC)) {
+ char tmp_buf[sizeof(conn->error_info.error)];
+ int tmp_error_no;
*is_warning = TRUE;
/* error occured */
- strcpy(conn->error_info.sqlstate, UNKNOWN_SQLSTATE);
- conn->error_info.error_no =
- infile.local_infile_error(info, conn->error_info.error, sizeof(conn->error_info.error) TSRMLS_CC);
+ tmp_error_no = infile.local_infile_error(info, tmp_buf, sizeof(tmp_buf) TSRMLS_CC);
+ SET_CLIENT_ERROR(conn->error_info, tmp_error_no, UNKNOWN_SQLSTATE, tmp_buf);
/* write empty packet to server */
ret = conn->net->m.send(conn, empty_packet, 0 TSRMLS_CC);
goto infile_error;
@@ -208,11 +209,12 @@ mysqlnd_handle_local_infile(MYSQLND *conn, const char *filename, zend_bool *is_w
/* error during read occured */
if (bufsize < 0) {
+ char tmp_buf[sizeof(conn->error_info.error)];
+ int tmp_error_no;
*is_warning = TRUE;
DBG_ERR_FMT("Bufsize < 0, warning, %d %s %s", CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn);
- strcpy(conn->error_info.sqlstate, UNKNOWN_SQLSTATE);
- conn->error_info.error_no =
- infile.local_infile_error(info, conn->error_info.error, sizeof(conn->error_info.error) TSRMLS_CC);
+ tmp_error_no = infile.local_infile_error(info, tmp_buf, sizeof(tmp_buf) TSRMLS_CC);
+ SET_CLIENT_ERROR(conn->error_info, tmp_error_no, UNKNOWN_SQLSTATE, tmp_buf);
goto infile_error;
}