MCPcopy Create free account
hub / github.com/MariaDB/server / fetch

Method fetch

sql/sql_cursor.cc:289–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287*/
288
289void Materialized_cursor::fetch(ulong num_rows)
290{
291 THD *thd= table->in_use;
292
293 int res= 0;
294 result->begin_dataset();
295 for (fetch_limit+= num_rows; fetch_count < fetch_limit; fetch_count++)
296 {
297 if ((res= table->file->ha_rnd_next(table->record[0])))
298 break;
299 /* Send data only if the read was successful. */
300 /*
301 If network write failed (i.e. due to a closed socked),
302 the error has already been set. Just return.
303 */
304 if (result->send_data(item_list) > 0)
305 return;
306 }
307
308 switch (res) {
309 case 0:
310 thd->server_status|= SERVER_STATUS_CURSOR_EXISTS;
311 result->send_eof();
312 break;
313 case HA_ERR_END_OF_FILE:
314 thd->server_status|= SERVER_STATUS_LAST_ROW_SENT;
315 result->send_eof();
316 close();
317 break;
318 default:
319 table->file->print_error(res, MYF(0));
320 close();
321 break;
322 }
323}
324
325
326void Materialized_cursor::close()

Callers 2

executeMethod · 0.45
mysqld_stmt_fetchFunction · 0.45

Calls 5

ha_rnd_nextMethod · 0.80
begin_datasetMethod · 0.45
send_dataMethod · 0.45
send_eofMethod · 0.45
print_errorMethod · 0.45

Tested by

no test coverage detected