MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Gelu Gogancea Date:July 10 2002 7:37am
Subject:Re: C API: mysql_data_seek
View as plain text  
Hi,

If i understand well you use twice mysql_data_seek.If you use
mysql_data_seek() after mysql_fetch_row() the effect is NULL.
Because mysql_data_seek() (in fact) set the cursor (if we can said like
this...) in the MResult (MYSQL_RES) and not in the "row" (MYSQL_ROW).

Regards,

Gelu
_____________________________________________________
G.NET SOFTWARE COMPANY

Permanent e-mail address : gg@stripped
                                          gelugogancea@stripped
----- Original Message -----
From: "Chan WieVia ICM N MC MI E3 Extern"
<WieVia.Chan.extern@stripped>
To: "'Gelu Gogancea'" <ggelu@stripped>; <mysql@stripped>
Sent: Wednesday, July 10, 2002 10:13 AM
Subject: RE: C API: mysql_data_seek


>
> Hi,
>
> Thanks for ur reply.
>
> When i "commented out" the "mysql_data_seek()" function,
"mysql_fetch_row()"
> returns me a non-NULL value (this should be the first row from the
MResult).
> This results show that I've a valid connection and/or query.  And when I
> call "mysql_fetch_row()" again (retrieving the 2nd row from the MResult,
> which is the desired row), it returns me a non-NULL value too.  From this
> result, I know that I've not seek past the result set.  However, with the
> addition of the "mysql_data_seek(MResult, 1)" function, a NULL value is
> returned.  And that's where I don't know how the mistake was made.
>
> Please advice and thanks.
>
> wv
>
>
> -----Original Message-----
> From: Gelu Gogancea [mailto:ggelu@stripped]
> Sent: 09 July 2002 23:03
> To: Chan WieVia ICM N MC MI E3 Extern; mysql@stripped
> Subject: Re: C API: mysql_data_seek
>
>
> Hi,
>
> It's ok but you must retrieve data from "row".
> int sql_result;x,i;
> 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_store_result return
in
> MResult  not in MQuery (here was :...mysql_store_result(&MQuery))
> mysql_data_seek(MResult, 1);     //it's ok here...i suppose you whish to
> retrieve data from  2-nd "row"....
>
> row = mysql_fetch_row( MResult) ;    // if you have a valid connection(or
> query) mysql_fetch_row should return non NULL value.
>
>       i = mysql_num_fields(MResult) ;
>       for ( x = 0 ; x < i ; x++ )
>         {
>             printf("Data from MYSQL_ROW : %s \n",row[x]);
>         }
>  mysql_free_result( res ) ;
>
> I hope it's help.
> Regards,
>
> Gelu
> _____________________________________________________
> G.NET SOFTWARE COMPANY
>
> Permanent e-mail address : gg@stripped
>                                           gelugogancea@stripped
> ----- Original Message -----
> From: "Chan WieVia ICM N MC MI E3 Extern"
> <WieVia.Chan.extern@stripped>
> To: <mysql@stripped>
> Sent: Tuesday, July 09, 2002 9:29 PM
> Subject: C API: mysql_data_seek
>
>
> >
> > 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?
> >
> > Thanks in advance.
> >
> > wv
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >    http://www.mysql.com/manual.php   (the manual)
> >    http://lists.mysql.com/           (the list archive)
> >
> > To request this thread, e-mail <mysql-thread114123@stripped>
> > To unsubscribe, e-mail
<mysql-unsubscribe-ggelu=arctic.ro@stripped>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> >
> >
>

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