Lines Matching refs:S
49 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; in pdo_mysql_stmt_dtor() local
52 PDO_DBG_INF_FMT("stmt=%p", S->stmt); in pdo_mysql_stmt_dtor()
53 if (S->result) { in pdo_mysql_stmt_dtor()
55 mysql_free_result(S->result); in pdo_mysql_stmt_dtor()
56 S->result = NULL; in pdo_mysql_stmt_dtor()
58 if (S->einfo.errmsg) { in pdo_mysql_stmt_dtor()
59 pefree(S->einfo.errmsg, stmt->dbh->is_persistent); in pdo_mysql_stmt_dtor()
60 S->einfo.errmsg = NULL; in pdo_mysql_stmt_dtor()
62 if (S->stmt) { in pdo_mysql_stmt_dtor()
63 pdo_mysql_stmt_close(S->stmt); in pdo_mysql_stmt_dtor()
64 S->stmt = NULL; in pdo_mysql_stmt_dtor()
68 if (S->params) { in pdo_mysql_stmt_dtor()
69 efree(S->params); in pdo_mysql_stmt_dtor()
71 if (S->in_null) { in pdo_mysql_stmt_dtor()
72 efree(S->in_null); in pdo_mysql_stmt_dtor()
74 if (S->in_length) { in pdo_mysql_stmt_dtor()
75 efree(S->in_length); in pdo_mysql_stmt_dtor()
78 if (S->bound_result) in pdo_mysql_stmt_dtor()
82 pdo_free_bound_result(S->bound_result[i]); in pdo_mysql_stmt_dtor()
85 efree(S->bound_result); in pdo_mysql_stmt_dtor()
86 efree(S->out_null); in pdo_mysql_stmt_dtor()
87 efree(S->out_length); in pdo_mysql_stmt_dtor()
92 if (S->H->server) { in pdo_mysql_stmt_dtor()
93 while (mysql_more_results(S->H->server)) { in pdo_mysql_stmt_dtor()
95 if (mysql_next_result(S->H->server) != 0) { in pdo_mysql_stmt_dtor()
99 res = mysql_store_result(S->H->server); in pdo_mysql_stmt_dtor()
107 if (!S->stmt && S->current_data) { in pdo_mysql_stmt_dtor()
108 mnd_free(S->current_data); in pdo_mysql_stmt_dtor()
112 efree(S); in pdo_mysql_stmt_dtor()
120 pdo_mysql_stmt *S = stmt->driver_data; in pdo_mysql_stmt_set_row_count() local
121 row_count = (long) mysql_stmt_affected_rows(S->stmt); in pdo_mysql_stmt_set_row_count()
130 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; in pdo_mysql_fill_stmt_from_result() local
131 pdo_mysql_db_handle *H = S->H; in pdo_mysql_fill_stmt_from_result()
140 S->result = mysql_use_result(H->server); in pdo_mysql_fill_stmt_from_result()
142 S->result = mysql_store_result(H->server); in pdo_mysql_fill_stmt_from_result()
144 if (NULL == S->result) { in pdo_mysql_fill_stmt_from_result()
149 stmt->row_count = (long) mysql_num_rows(S->result); in pdo_mysql_fill_stmt_from_result()
150 stmt->column_count = (int) mysql_num_fields(S->result); in pdo_mysql_fill_stmt_from_result()
151 S->fields = mysql_fetch_fields(S->result); in pdo_mysql_fill_stmt_from_result()
164 pdo_mysql_stmt *S = stmt->driver_data; in pdo_mysql_stmt_execute_prepared_libmysql() local
165 pdo_mysql_db_handle *H = S->H; in pdo_mysql_stmt_execute_prepared_libmysql()
170 if (mysql_stmt_bind_param(S->stmt, S->params) || mysql_stmt_execute(S->stmt)) { in pdo_mysql_stmt_execute_prepared_libmysql()
171 if (S->params) { in pdo_mysql_stmt_execute_prepared_libmysql()
172 memset(S->params, 0, S->num_params * sizeof(MYSQL_BIND)); in pdo_mysql_stmt_execute_prepared_libmysql()
175 if (mysql_stmt_errno(S->stmt) == 2057) { in pdo_mysql_stmt_execute_prepared_libmysql()
177 S->stmt = NULL; in pdo_mysql_stmt_execute_prepared_libmysql()
182 if (!S->result) { in pdo_mysql_stmt_execute_prepared_libmysql()
186 S->result = mysql_stmt_result_metadata(S->stmt); in pdo_mysql_stmt_execute_prepared_libmysql()
187 if (S->result) { in pdo_mysql_stmt_execute_prepared_libmysql()
188 int calc_max_length = H->buffered && S->max_length == 1; in pdo_mysql_stmt_execute_prepared_libmysql()
189 S->fields = mysql_fetch_fields(S->result); in pdo_mysql_stmt_execute_prepared_libmysql()
190 if (S->bound_result) { in pdo_mysql_stmt_execute_prepared_libmysql()
193 efree(S->bound_result[i].buffer); in pdo_mysql_stmt_execute_prepared_libmysql()
195 efree(S->bound_result); in pdo_mysql_stmt_execute_prepared_libmysql()
196 efree(S->out_null); in pdo_mysql_stmt_execute_prepared_libmysql()
197 efree(S->out_length); in pdo_mysql_stmt_execute_prepared_libmysql()
200 stmt->column_count = (int)mysql_num_fields(S->result); in pdo_mysql_stmt_execute_prepared_libmysql()
201 S->bound_result = ecalloc(stmt->column_count, sizeof(MYSQL_BIND)); in pdo_mysql_stmt_execute_prepared_libmysql()
202 S->out_null = ecalloc(stmt->column_count, sizeof(my_bool)); in pdo_mysql_stmt_execute_prepared_libmysql()
203 S->out_length = ecalloc(stmt->column_count, sizeof(unsigned long)); in pdo_mysql_stmt_execute_prepared_libmysql()
207 if (calc_max_length && S->fields[i].type == FIELD_TYPE_BLOB) { in pdo_mysql_stmt_execute_prepared_libmysql()
209 mysql_stmt_attr_set(S->stmt, STMT_ATTR_UPDATE_MAX_LENGTH, &on); in pdo_mysql_stmt_execute_prepared_libmysql()
212 switch (S->fields[i].type) { in pdo_mysql_stmt_execute_prepared_libmysql()
214 S->bound_result[i].buffer_length = MAX_MEDIUMINT_WIDTH + 1; in pdo_mysql_stmt_execute_prepared_libmysql()
217 S->bound_result[i].buffer_length = MAX_INT_WIDTH + 1; in pdo_mysql_stmt_execute_prepared_libmysql()
220 S->bound_result[i].buffer_length = MAX_BIGINT_WIDTH + 1; in pdo_mysql_stmt_execute_prepared_libmysql()
223 S->bound_result[i].buffer_length = MAX_TINYINT_WIDTH + 1; in pdo_mysql_stmt_execute_prepared_libmysql()
226 S->bound_result[i].buffer_length = MAX_SMALLINT_WIDTH + 1; in pdo_mysql_stmt_execute_prepared_libmysql()
229 S->bound_result[i].buffer_length = in pdo_mysql_stmt_execute_prepared_libmysql()
230 S->fields[i].max_length? S->fields[i].max_length: in pdo_mysql_stmt_execute_prepared_libmysql()
231 S->fields[i].length; in pdo_mysql_stmt_execute_prepared_libmysql()
233 if (S->bound_result[i].buffer_length > H->max_buffer_size) { in pdo_mysql_stmt_execute_prepared_libmysql()
234 S->bound_result[i].buffer_length = H->max_buffer_size; in pdo_mysql_stmt_execute_prepared_libmysql()
242 …if (S->fields[i].max_length == 0 && S->bound_result[i].buffer_length < 128 && MYSQL_TYPE_VAR_STRIN… in pdo_mysql_stmt_execute_prepared_libmysql()
243 S->bound_result[i].buffer_length = 128; in pdo_mysql_stmt_execute_prepared_libmysql()
246 S->out_length[i] = 0; in pdo_mysql_stmt_execute_prepared_libmysql()
248 S->bound_result[i].buffer = emalloc(S->bound_result[i].buffer_length); in pdo_mysql_stmt_execute_prepared_libmysql()
249 S->bound_result[i].is_null = &S->out_null[i]; in pdo_mysql_stmt_execute_prepared_libmysql()
250 S->bound_result[i].length = &S->out_length[i]; in pdo_mysql_stmt_execute_prepared_libmysql()
251 S->bound_result[i].buffer_type = MYSQL_TYPE_STRING; in pdo_mysql_stmt_execute_prepared_libmysql()
254 if (mysql_stmt_bind_result(S->stmt, S->bound_result)) { in pdo_mysql_stmt_execute_prepared_libmysql()
261 mysql_stmt_store_result(S->stmt); in pdo_mysql_stmt_execute_prepared_libmysql()
275 pdo_mysql_stmt *S = stmt->driver_data; in pdo_mysql_stmt_execute_prepared_mysqlnd() local
276 pdo_mysql_db_handle *H = S->H; in pdo_mysql_stmt_execute_prepared_mysqlnd()
281 if (mysql_stmt_execute(S->stmt)) { in pdo_mysql_stmt_execute_prepared_mysqlnd()
286 if (S->result) { in pdo_mysql_stmt_execute_prepared_mysqlnd()
288 mysql_free_result(S->result); in pdo_mysql_stmt_execute_prepared_mysqlnd()
289 S->result = NULL; in pdo_mysql_stmt_execute_prepared_mysqlnd()
293 stmt->column_count = mysql_stmt_field_count(S->stmt); in pdo_mysql_stmt_execute_prepared_mysqlnd()
295 mysqlnd_stmt_bind_one_result(S->stmt, i); in pdo_mysql_stmt_execute_prepared_mysqlnd()
298 S->result = mysqlnd_stmt_result_metadata(S->stmt); in pdo_mysql_stmt_execute_prepared_mysqlnd()
299 if (S->result) { in pdo_mysql_stmt_execute_prepared_mysqlnd()
300 S->fields = mysql_fetch_fields(S->result); in pdo_mysql_stmt_execute_prepared_mysqlnd()
303 if (mysql_stmt_store_result(S->stmt)) { in pdo_mysql_stmt_execute_prepared_mysqlnd()
317 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; in pdo_mysql_stmt_execute() local
318 pdo_mysql_db_handle *H = S->H; in pdo_mysql_stmt_execute()
320 PDO_DBG_INF_FMT("stmt=%p", S->stmt); in pdo_mysql_stmt_execute()
322 if (S->stmt) { in pdo_mysql_stmt_execute()
327 if (S->result) { in pdo_mysql_stmt_execute()
328 mysql_free_result(S->result); in pdo_mysql_stmt_execute()
329 S->result = NULL; in pdo_mysql_stmt_execute()
343 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; in pdo_mysql_stmt_next_rowset() local
344 pdo_mysql_db_handle *H = S->H; in pdo_mysql_stmt_next_rowset()
347 PDO_DBG_INF_FMT("stmt=%p", S->stmt); in pdo_mysql_stmt_next_rowset()
351 if (!mysqlnd_stmt_more_results(S->stmt)) { in pdo_mysql_stmt_next_rowset()
354 if (mysqlnd_stmt_next_result(S->stmt)) { in pdo_mysql_stmt_next_rowset()
358 if (!mysqlnd_stmt_more_results(S->stmt)) { in pdo_mysql_stmt_next_rowset()
369 if (S->result) { in pdo_mysql_stmt_next_rowset()
370 mysql_free_result(S->result); in pdo_mysql_stmt_next_rowset()
371 S->result = NULL; in pdo_mysql_stmt_next_rowset()
377 stmt->column_count = mysql_stmt_field_count(S->stmt); in pdo_mysql_stmt_next_rowset()
379 mysqlnd_stmt_bind_one_result(S->stmt, i); in pdo_mysql_stmt_next_rowset()
383 S->result = mysqlnd_stmt_result_metadata(S->stmt); in pdo_mysql_stmt_next_rowset()
384 if (S->result) { in pdo_mysql_stmt_next_rowset()
385 S->fields = mysql_fetch_fields(S->result); in pdo_mysql_stmt_next_rowset()
389 if (mysql_stmt_store_result(S->stmt)) { in pdo_mysql_stmt_next_rowset()
394 row_count = (long) mysql_stmt_affected_rows(S->stmt); in pdo_mysql_stmt_next_rowset()
404 if (S->stmt) { in pdo_mysql_stmt_next_rowset()
405 stmt->column_count = (int)mysql_num_fields(S->result); in pdo_mysql_stmt_next_rowset()
406 mysql_stmt_free_result(S->stmt); in pdo_mysql_stmt_next_rowset()
409 if (S->result) { in pdo_mysql_stmt_next_rowset()
410 mysql_free_result(S->result); in pdo_mysql_stmt_next_rowset()
411 S->result = NULL; in pdo_mysql_stmt_next_rowset()
454 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; in pdo_mysql_stmt_param_hook() local
457 PDO_DBG_INF_FMT("stmt=%p", S->stmt); in pdo_mysql_stmt_param_hook()
459 if (S->stmt && param->is_param) { in pdo_mysql_stmt_param_hook()
463 if (param->paramno < 0 || param->paramno >= S->num_params) { in pdo_mysql_stmt_param_hook()
467 S->params_given++; in pdo_mysql_stmt_param_hook()
470 b = &S->params[param->paramno]; in pdo_mysql_stmt_param_hook()
472 b->is_null = &S->in_null[param->paramno]; in pdo_mysql_stmt_param_hook()
473 b->length = &S->in_length[param->paramno]; in pdo_mysql_stmt_param_hook()
479 if (S->params_given < (unsigned int) S->num_params) { in pdo_mysql_stmt_param_hook()
489 mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, param->parameter, MYSQL_TYPE_NULL); in pdo_mysql_stmt_param_hook()
535 mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, param->parameter, MYSQL_TYPE_VAR_STRING); in pdo_mysql_stmt_param_hook()
539 mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, param->parameter, MYSQL_TYPE_LONGLONG); in pdo_mysql_stmt_param_hook()
541 mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, param->parameter, MYSQL_TYPE_LONG); in pdo_mysql_stmt_param_hook()
545 mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, param->parameter, MYSQL_TYPE_DOUBLE); in pdo_mysql_stmt_param_hook()
592 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; local
597 PDO_DBG_INF_FMT("stmt=%p", S->stmt);
598 if (S->stmt) {
599 if (FAIL == mysqlnd_stmt_fetch(S->stmt, &fetched_anything) || fetched_anything == FALSE) {
608 if (S->stmt) {
609 ret = mysql_stmt_fetch(S->stmt);
628 if (!S->result) {
633 if (!S->stmt && S->current_data) {
634 mnd_free(S->current_data);
638 if ((S->current_data = mysql_fetch_row(S->result)) == NULL) {
640 if (S->result->unbuf && !S->result->unbuf->eof_reached && mysql_errno(S->H->server)) {
642 if (!S->result->eof && mysql_errno(S->H->server)) {
649 S->current_lengths = mysql_fetch_lengths(S->result);
656 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; local
661 PDO_DBG_INF_FMT("stmt=%p", S->stmt);
662 if (!S->result) {
680 if (S->H->fetch_table_names) {
681 namelen = spprintf(&cols[i].name, 0, "%s.%s", S->fields[i].table, S->fields[i].name);
684 namelen = strlen(S->fields[i].name);
686 cols[i].name = estrndup(S->fields[i].name, namelen);
689 cols[i].precision = S->fields[i].decimals;
690 cols[i].maxlen = S->fields[i].length;
693 if (S->stmt) {
707 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; local
710 PDO_DBG_INF_FMT("stmt=%p", S->stmt);
711 if (!S->result) {
716 if (!S->stmt) {
717 if (S->current_data == NULL || !S->result) {
727 if (S->stmt) {
728 Z_ADDREF_P(S->stmt->data->result_bind[colno].zv);
729 *ptr = (char*)&S->stmt->data->result_bind[colno].zv;
734 if (S->stmt) {
735 if (S->out_null[colno]) {
740 *ptr = S->bound_result[colno].buffer;
741 if (S->out_length[colno] > S->bound_result[colno].buffer_length) {
744 S->out_length[colno] = S->bound_result[colno].buffer_length;
745 *len = S->out_length[colno];
748 *len = S->out_length[colno];
752 *ptr = S->current_data[colno];
753 *len = S->current_lengths[colno];
808 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; local
814 PDO_DBG_INF_FMT("stmt=%p", S->stmt);
815 if (!S->result) {
827 F = S->fields + colno;
878 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; local
881 PDO_DBG_INF_FMT("stmt=%p", S->stmt);
882 if (S->result) {
883 mysql_free_result(S->result);
884 S->result = NULL;
886 if (S->stmt) {
888 retval = mysql_stmt_free_result(S->stmt);
892 while (mysql_more_results(S->H->server)) {
894 if (mysql_next_result(S->H->server) != 0) {
897 res = mysql_store_result(S->H->server);