diff options
author | Andrey Hristov <andrey@php.net> | 2011-08-04 09:51:26 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2011-08-04 09:51:26 +0000 |
commit | c9e7716cfd137b7c9ec2980273b3bbd4bc743e1f (patch) | |
tree | 078196a1b05032c38ed91c487438f32f3a10dc10 /ext/mysqlnd/mysqlnd_loaddata.c | |
parent | d8f08192effdd786e00dfc4da8ee762b066382b6 (diff) | |
download | php-git-c9e7716cfd137b7c9ec2980273b3bbd4bc743e1f.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.c | 14 |
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; } |