MYSQLND_PACKET_EOF * ok_response = conn->protocol->m.get_eof_packet(conn->protocol, FALSE TSRMLS_CC);
if (!ok_response) {
SET_OOM_ERROR(conn->error_info);
- break;
+ break;
}
if (FAIL == (ret = PACKET_READ(ok_response, conn))) {
SET_CLIENT_ERROR(conn->error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE,
goto err;
}
memcpy(auth_packet->server_scramble_buf, greet_packet->scramble_buf, SCRAMBLE_LENGTH);
-
+
if (!PACKET_WRITE(auth_packet, conn)) {
CONN_SET_STATE(conn, CONN_QUIT_SENT);
SET_CLIENT_ERROR(conn->error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone);
if (FAIL == conn->net->m.enable_ssl(conn->net TSRMLS_CC)) {
goto err;
}
-
+
auth_packet->send_half_packet = FALSE;
if (!PACKET_WRITE(auth_packet, conn)) {
CONN_SET_STATE(conn, CONN_QUIT_SENT);
FALSE, TRUE TSRMLS_CC)) {
DBG_RETURN(NULL);
}
-
+
/*
Prepare for the worst case.
MyISAM goes to 2500 BIT columns, double it for safety.
- */
+ */
result = conn->m->result_init(5000, conn->persistent TSRMLS_CC);
if (!result) {
DBG_RETURN(NULL);
int2store(p, conn->charset->nr);
p+=2;
}
-
+
if (PASS != conn->m->simple_command(conn, COM_CHANGE_USER, buffer, p - buffer,
PROT_LAST /* we will handle the OK packet*/,
silent, TRUE TSRMLS_CC)) {
} else if (ret == FAIL && chg_user_resp->server_asked_323_auth == TRUE) {
/* old authentication with new server !*/
DBG_ERR(mysqlnd_old_passwd);
- SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, mysqlnd_old_passwd);
+ SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, mysqlnd_old_passwd);
}
end:
PACKET_FREE(chg_user_resp);
conn->current_result->m.free_result(conn->current_result, TRUE TSRMLS_CC);
}
conn->current_result = NULL;
-
+
DBG_RETURN(result);
}
/* }}} */
result = conn->current_result->m.store_result(conn->current_result, conn, FALSE TSRMLS_CC);
if (!result) {
- conn->current_result->m.free_result(conn->current_result, TRUE TSRMLS_CC);
+ conn->current_result->m.free_result(conn->current_result, TRUE TSRMLS_CC);
}
conn->current_result = NULL;
DBG_RETURN(result);
DBG_RETURN(FAIL);
}
chunk->ptr = new_ptr;
-
}
DBG_RETURN(PASS);
}
if (start + 2 > end) {
return 0;
}
-
+
if (UTF16_HIGH_HEAD(*start)) {
return (start + 4 <= end) && UTF16_LOW_HEAD(start[2]) ? 4 : 0;
}
ret->m = & mysqlnd_mysqlnd_debug_methods;
ret->skip_functions = skip_functions;
-
+
return ret;
}
/* }}} */
return;
}
}
-
+
dbg->m->close(dbg);
dbg->m->set_mode(dbg, mode);
while (zend_stack_count(&dbg->call_stack)) {
#define __zend_filename "/unknown/unknown"
#define __zend_lineno 0
#endif
-
+
#define REAL_SIZE(s) (collect_memory_statistics? (s) + sizeof(size_t) : (s))
#define REAL_PTR(p) (collect_memory_statistics && (p)? (((char *)(p)) - sizeof(size_t)) : (p))
#define FAKE_PTR(p) (collect_memory_statistics && (p)? (((char *)(p)) + sizeof(size_t)) : (p))
if (!info) {
DBG_RETURN(1);
}
-
+
*ptr = info;
/* check open_basedir */
}
if ((result = result->m.store_result(result, conn, TRUE TSRMLS_CC))) {
- stmt->upsert_status.affected_rows = result->stored_data->row_count;
+ stmt->upsert_status.affected_rows = result->stored_data->row_count;
stmt->state = MYSQLND_STMT_PREPARED;
result->type = MYSQLND_RES_PS_BUF;
} else {
if (!prepare_resp) {
SET_OOM_ERROR(stmt->error_info);
SET_OOM_ERROR(stmt->conn->error_info);
- goto done;
+ goto done;
}
if (FAIL == PACKET_READ(prepare_resp, stmt->conn)) {
SET_ERROR_AFF_ROWS(stmt);
SET_ERROR_AFF_ROWS(stmt->conn);
-
+
if (stmt->result && stmt->state >= MYSQLND_STMT_PREPARED && stmt->field_count) {
/*
We don need to copy the data from the buffers which we will clean.
stmt->error_info = row_packet->error_info;
}
CONN_SET_STATE(result->conn, CONN_READY);
- result->unbuf->eof_reached = TRUE; /* so next time we won't get an error */
+ result->unbuf->eof_reached = TRUE; /* so next time we won't get an error */
} else if (row_packet->eof) {
DBG_INF("EOF");
/* Mark the connection as usable again */
MYSQLND * conn;
zend_uchar *cmd_buf;
enum php_mysqlnd_server_command cmd = COM_STMT_SEND_LONG_DATA;
-
+
DBG_ENTER("mysqlnd_stmt::send_long_data");
if (!stmt || !stmt->conn) {
DBG_RETURN(FAIL);
memcpy(cmd_buf + STMT_ID_LENGTH + 2, data, length);
/* COM_STMT_SEND_LONG_DATA doesn't send an OK packet*/
- ret = conn->m->simple_command(conn, cmd, (char *)cmd_buf, packet_len,
- PROT_LAST , FALSE, TRUE TSRMLS_CC);
+ ret = conn->m->simple_command(conn, cmd, (char *)cmd_buf, packet_len, PROT_LAST , FALSE, TRUE TSRMLS_CC);
mnd_efree(cmd_buf);
if (FAIL == ret) {
stmt->error_info = conn->error_info;
}
} else {
ret = FAIL;
- SET_OOM_ERROR(stmt->error_info);
- SET_OOM_ERROR(conn->error_info);
+ SET_OOM_ERROR(stmt->error_info);
+ SET_OOM_ERROR(conn->error_info);
}
/*
Cover protocol error: COM_STMT_SEND_LONG_DATA was designed to be quick and not
DBG_RETURN(FAIL);
}
}
-
+
/* Prevent from freeing */
/* Don't update is_ref, or we will leak during conversion */
Z_ADDREF_P(zv);
}
stmt->param_bind[param_no].zv = zv;
stmt->param_bind[param_no].type = type;
-
+
stmt->send_types_to_server = 1;
}
DBG_INF("PASS");
if (result) {
result->m.free_result(result, TRUE TSRMLS_CC);
}
- DBG_RETURN(NULL);
+ DBG_RETURN(NULL);
}
/* }}} */
DBG_RETURN(ret);
} while (0);
-
+
SET_OOM_ERROR(conn->error_info);
if (ret) {
ret->m->dtor(ret, TRUE TSRMLS_CC);
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DOUBLE].pack_len = 8;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DOUBLE].php_type = IS_DOUBLE;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DOUBLE].can_ret_as_str_in_uni = TRUE;
-
+
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIME].func = ps_fetch_time;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIME].pack_len = MYSQLND_PS_SKIP_RESULT_W_LEN;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIME].php_type = IS_STRING;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].pack_len = MYSQLND_PS_SKIP_RESULT_W_LEN;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].php_type = IS_STRING;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].can_ret_as_str_in_uni = TRUE;
-
+
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATETIME].func = ps_fetch_datetime;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATETIME].pack_len= MYSQLND_PS_SKIP_RESULT_W_LEN;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATETIME].php_type= IS_STRING;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIMESTAMP].pack_len= MYSQLND_PS_SKIP_RESULT_W_LEN;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIMESTAMP].php_type= IS_STRING;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TIMESTAMP].can_ret_as_str_in_uni = TRUE;
-
+
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY_BLOB].func = ps_fetch_string;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY_BLOB].pack_len= MYSQLND_PS_SKIP_RESULT_STR;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY_BLOB].php_type = IS_STRING;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_BLOB].php_type = IS_STRING;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_BLOB].is_possibly_blob = TRUE;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_BLOB].can_ret_as_str_in_uni = TRUE;
-
+
mysqlnd_ps_fetch_functions[MYSQL_TYPE_MEDIUM_BLOB].func = ps_fetch_string;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_MEDIUM_BLOB].pack_len = MYSQLND_PS_SKIP_RESULT_STR;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_MEDIUM_BLOB].php_type = IS_STRING;
time we try to send > LONG_MAX, the conversion to string will send a string and the server
won't expect it and interpret the value as 0. Thus we need to resend the types, if any such values
occur, and force resend for the next execution.
-
*/
for (i = 0; i < stmt->param_count; i++) {
if (Z_TYPE_P(stmt->param_bind[i].zv) != IS_NULL &&
}
memcpy(tmp_buf, *buf, offset);
*buf = tmp_buf;
-
+
/* Update our pos pointer */
*p = *buf + offset;
}
{
zval *tmp_data = (copies && copies[i])? copies[i]: stmt->param_bind[i].zv;
if (Z_TYPE_P(tmp_data) == IS_STRING) {
- goto use_string;
+ goto use_string;
}
convert_to_long_ex(&tmp_data);
}
{
zval *tmp_data = (copies && copies[i])? copies[i]: stmt->param_bind[i].zv;
if (Z_TYPE_P(tmp_data) == IS_STRING) {
- goto use_string;
+ goto use_string;
}
convert_to_long_ex(&tmp_data);
}
data_size += Z_STRLEN_P(the_var);
break;
}
-
}
/* 2.2 Enlarge the buffer, if needed */
ctor_called_count,
STAT_COPY_ON_WRITE_SAVED,
result->field_count - ctor_called_count);
-
/* Free last row's zvals */
mnd_efree(unbuf->last_row_data);
unbuf->last_row_data = NULL;
ret = FAIL;
break;
}
-
+
if (FAIL == (ret = result->m.read_result_metadata(result, conn TSRMLS_CC))) {
/* For PS, we leave them in Prepared state */
if (!stmt && conn->current_result) {
if (!row_packet) {
SET_OOM_ERROR(conn->error_info);
ret = FAIL;
- goto end;
+ goto end;
}
row_packet->result_set_memory_pool = result->result_set_memory_pool;
row_packet->field_count = meta->field_count;
zend_hash_move_forward(Z_ARRVAL(row));
zend_hash_get_current_data(Z_ARRVAL(row), (void **)&entry);
}
-
+
zend_hash_get_current_data(Z_ARRVAL(row), (void **)&entry);
*return_value = **entry;
DBG_ENTER("mysqlnd_result_init");
DBG_INF_FMT("field_count=%u", field_count);
-
+
if (!ret) {
DBG_RETURN(NULL);
}
PACKET_FREE(field_packet);
DBG_RETURN(FAIL);
}
-
+
if (field_packet->stupid_list_fields_eof == TRUE) {
meta->field_count = i;
break;
meta->bit_fields_total_len += 3;/* 120 */
break;
}
-
}
#if MYSQLND_UNICODE
MYSQLND_RES_METADATA *ret = mnd_pecalloc(1, alloc_size, persistent);
DBG_ENTER("mysqlnd_result_meta_init");
DBG_INF_FMT("persistent=%u", persistent);
-
+
do {
if (!ret) {
break;
int ulen, tlen;
#endif
char tmp[25];
-
+
sprintf((char *)&tmp, MYSQLND_LLU_SPEC, stats->values[i]);
#if MYSQLND_UNICODE
zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, names[i].s, names[i].l + 1 TSRMLS_CC);
MYSQLND_STAT_CALL_TRIGGER((stats), (statistic), (value)); \
MYSQLND_STATS_UNLOCK(_p_s); \
}
-
+
#define MYSQLND_DEC_STATISTIC(enabler, stats, statistic) \
{ \
enum_mysqlnd_collected_stats _s = (statistic);\
DBG_RETURN(FAIL);
}
}
-
+
for (i = 0, current_field = start_field; current_field < end_field; current_field++, i++) {
enum_mysqlnd_collected_stats statistic;
-
+
DBG_INF_FMT("Into zval=%p decoding column %u [%s.%s.%s] type=%u field->flags&unsigned=%u flags=%u is_bit=%u as_unicode=%u",
*current_field, i,
fields_metadata[i].db, fields_metadata[i].table, fields_metadata[i].name, fields_metadata[i].type,