zval *mysql_stmt;
MYSQL_BIND *bind;
+ if (getThis()) {
+ start = 0;
+ }
+
+ if (zend_parse_method_parameters((getThis()) ? 0:1 TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
+ return;
+ }
+
+ MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt");
+
if (argc < (getThis() ? 1 : 2)) {
WRONG_PARAM_COUNT;
}
WRONG_PARAM_COUNT;
}
- if (getThis()) {
- start = 0;
- }
-
- if (zend_parse_method_parameters((getThis()) ? 0:1 TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
- }
-
- MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt");
var_cnt = argc - start;
if (!(ret = mysql_stmt_fetch(stmt->stmt))) {
for (i = 0; i < stmt->result.var_cnt; i++) {
if (stmt->result.vars[i]->type == IS_STRING && stmt->result.vars[i]->value.str.len) {
- efree(stmt->result.vars[i]->value.str.val);
+ efree(stmt->result.vars[i]->value.str.val);
}
if (!stmt->result.is_null[i]) {
switch (stmt->result.buf[i].type) {
}
if (!socket_len) {
- socket = NULL;
- }
+ socket = NULL;
+ }
/* TODO: safe mode handling */
if (PG(sql_safe_mode)){
MYSQLI_ENABLE_MQ;
if (mysql_real_query(mysql->mysql, query, query_len)) {
- MYSQLI_DISABLE_MQ;
+ char s_error[MYSQL_ERRMSG_SIZE], s_sqlstate[SQLSTATE_LENGTH+1];
+ unsigned int s_errno;
MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
+
+ /* we have to save error information, cause
+ MYSQLI_DISABLE_MQ will reset error information */
+ strcpy(s_error, mysql_error(mysql->mysql));
+ strcpy(s_sqlstate, mysql_sqlstate(mysql->mysql));
+ s_errno = mysql_errno(mysql->mysql);
+
+ MYSQLI_DISABLE_MQ;
+
+ /* restore error information */
+ strcpy(mysql->mysql->net.last_error, s_error);
+ strcpy(mysql->mysql->net.sqlstate, s_sqlstate);
+ mysql->mysql->net.last_errno = s_errno;
+
RETURN_FALSE;
}
RETURN_TRUE;
[4]=>
string(19) "2010-07-10 00:00:00"
[5]=>
- string(0) ""
+ string(19) "0000-00-00 00:00:00"
[6]=>
string(19) "1999-12-29 00:00:00"
}
[4]=>
string(19) "2010-07-10 00:00:00"
[5]=>
- string(0) ""
+ string(19) "0000-00-00 00:00:00"
[6]=>
string(19) "1999-12-29 00:00:00"
}