MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / mysql_fetch_row

Function mysql_fetch_row

sql-common/client.c:4294–4340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4292**************************************************************************/
4293
4294MYSQL_ROW STDCALL
4295mysql_fetch_row(MYSQL_RES *res)
4296{
4297 DBUG_ENTER("mysql_fetch_row");
4298 if (!res->data)
4299 { /* Unbufferred fetch */
4300 if (!res->eof)
4301 {
4302 MYSQL *mysql= res->handle;
4303 if (mysql->status != MYSQL_STATUS_USE_RESULT)
4304 {
4305 set_mysql_error(mysql,
4306 res->unbuffered_fetch_cancelled ?
4307 CR_FETCH_CANCELED : CR_COMMANDS_OUT_OF_SYNC,
4308 unknown_sqlstate);
4309 }
4310 else if (!(read_one_row(mysql, res->field_count, res->row, res->lengths)))
4311 {
4312 res->row_count++;
4313 DBUG_RETURN(res->current_row=res->row);
4314 }
4315 DBUG_PRINT("info",("end of data"));
4316 res->eof=1;
4317 mysql->status=MYSQL_STATUS_READY;
4318 /*
4319 Reset only if owner points to us: there is a chance that somebody
4320 started new query after mysql_stmt_close():
4321 */
4322 if (mysql->unbuffered_fetch_owner == &res->unbuffered_fetch_cancelled)
4323 mysql->unbuffered_fetch_owner= 0;
4324 /* Don't clear handle in mysql_free_result */
4325 res->handle=0;
4326 }
4327 DBUG_RETURN((MYSQL_ROW) NULL);
4328 }
4329 {
4330 MYSQL_ROW tmp;
4331 if (!res->data_cursor)
4332 {
4333 DBUG_PRINT("info",("end of data"));
4334 DBUG_RETURN(res->current_row=(MYSQL_ROW) NULL);
4335 }
4336 tmp = res->data_cursor->data;
4337 res->data_cursor = res->data_cursor->next;
4338 DBUG_RETURN(res->current_row=tmp);
4339 }
4340}
4341
4342
4343/**************************************************************************

Callers 6

check_licenseFunction · 0.85
find_best_indexFunction · 0.85
is_this_tableFunction · 0.85
get_key_nameFunction · 0.85

Calls 2

set_mysql_errorFunction · 0.85
read_one_rowFunction · 0.85

Tested by

no test coverage detected