List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:July 9 2002 7:28pm
Subject:Re: C API: mysql_data_seek
View as plain text  
In the last episode (Jul 09), Chan WieVia ICM N MC MI E3 Extern said:
> 
> Hi,
> 
> I'm using the MySQL built-in C function, mysql_data_seek, for accessing a
> particular row from the Result (MYSQL_RES) returned by mysql_store_result.
> 
> 	int 			sql_result;
> 	MYSQL_RES		*MResult;
> 	MYSQL_ROW	row;
> 	MYSQL		MQuery;
> 	char 			SQLQuery[];
> 
> 	sprintf( SQLQuery, "SELECT * FROM Profile" );
> 	sql_result = mysql_query(SQLQuery);
> 	MResult = mysql_store_result(&MQuery);
> 	mysql_data_seek(MResult, 1);
> 	row = mysql_fetch_row(MResult);
> 
> However, "row" returns NULL.  I wonder if I've made any mistake in the
> process.  Can someone please help to check?  In addition, is there any
> special considerations when using this function?

mysql_data_seek counts from 0.  You seeked past the only record in the
result, which is why you get NULL from mysql_fetch_row.

-- 
	Dan Nelson
	dnelson@stripped
Thread
C API: mysql_data_seekChan WieVia ICM N MC MI E3 Extern9 Jul
  • Re: C API: mysql_data_seekDan Nelson9 Jul
  • Re: C API: mysql_data_seekGelu Gogancea9 Jul
  • Re: C API: mysql_data_seekGelu Gogancea9 Jul
RE: C API: mysql_data_seekChan WieVia ICM N MC MI E3 Extern10 Jul
  • Re: C API: mysql_data_seekGelu Gogancea10 Jul
RE: C API: mysql_data_seekChan WieVia ICM N MC MI E3 Extern10 Jul
  • Re: C API: mysql_data_seekGelu Gogancea10 Jul
RE: C API: mysql_data_seekChan WieVia ICM N MC MI E3 Extern10 Jul
  • Re: C API: mysql_data_seekGelu Gogancea10 Jul