Ace,

I am sorry to get into this so late, but you didn't mention what version you 
are running.

If you are running 5.0.1 or greater, you can use the MySQL function ROW_COUNT().

You will find that it will help you in returning the results that you need.

Here's the page in the manual for your review:

http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_row-count

HTH!

J.R.

----------------------------------------

                                From: Ace <[EMAIL PROTECTED]>
Sent: Tuesday, June 12, 2007 1:07 AM
To: "Michael Dykman" <[EMAIL PROTECTED]>
Subject: Re: how to get Number of rows matched? 

Thanks All for your help!

If someone from MySQL team is looking at this mail thread, we request to
include this feature in future release.

Cheers,
Rajan
On 6/11/07, Michael Dykman  wrote:
>
> no, there is nothing else.  There are cleaner interfaces to this
> information but, for PHP. the string returned by mysql_info() is all
> you get.  The format of that string is very regular and we have been
> using it in production software for well over a year now with no
> issues.
>
> - michael
>
>
> On 6/11/07, Ace  wrote:
> > Yes, you are right!  mysql_info() is not most useful. It does give me
> number
> > of rows matched but will involve complications of parsing the string.
> >
> > Is there no other way to this? How can this be missed? I am not so
> > convinienced on mysql_info()!
> >
> >
> > On 6/11/07, Jerry Schwartz  wrote:
> > >
> > > Have you looked at mysql_info()? The format of the return value might
> not
> > > be
> > > the most useful, but it should give you what you need.
> > >
> > > Regards,
> > >
> > > Jerry Schwartz
> > > The Infoshop by Global Information Incorporated
> > > 195 Farmington Ave.
> > > Farmington, CT 06032
> > >
> > > 860.674.8796 / FAX: 860.674.8341
> > >
> > > www.the-infoshop.com
> > > www.giiexpress.com
> > > www.etudes-marche.com
> > >
> > >
> > > > -----Original Message-----
> > > > From: ViSolve DB Team [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday, June 11, 2007 6:15 AM
> > > > To: Ace; mysql@lists.mysql.com
> > > > Subject: Re: how to get Number of rows matched?
> > > >
> > > > Hi
> > > >
> > > > AFAIK, before changing data, the old values are saved in the
> rollback
> > > > segment.
> > > > On saving the updated values, from the Buffer to the rollback
> > > > segment/data
> > > > files,
> > > > --- it checks if there is any matched row that matches the
> > > > condition.  If
> > > > found, then flags "Matched".
> > > > ---after filtering out the matched row, it check whether
> > > > there is need to
> > > > change the old value to new value. if need then flags
> > > > "Changed" and rewrite
> > > > the same in the datafile/rollback segment.
> > > >
> > > >
> > > > Thanks
> > > > ViSolve DB Team.
> > > > ----- Original Message -----
> > > > From: "Ace" 
> > > > To: 
> > > > Sent: Monday, June 11, 2007 11:41 AM
> > > > Subject: how to get Number of rows matched?
> > > >
> > > >
> > > > > Hi Experts,
> > > > >
> > > > > When issuing updates in mysql (in the console window),
> > > > mysql will tell
> > > > > you if any rows matched and how many rows were updated (see
> > > > below).  I
> > > > > know how to get number of rows udpated using
> > > > mysql_affected_rows(), but is
> > > > > there any
> > > > > way to get the number of rows matched?  I want to find out,
> > > > when rows
> > > > > updated = 0, if there were no updates because the row wasn't found
> > > > > (rows matched will = 0) or because the update would not have
> changed
> > > > > any data (rows matched = 1).
> > > > >
> > > > > mysql> select * from test;
> > > > > +------+------+
> > > > > | roll | s    |
> > > > > +------+------+
> > > > > |    1 | new  |
> > > > > +------+------+
> > > > > 1 row in set (0.00 sec)
> > > > >
> > > > > mysql> update test set roll = 1, s = 'new' where roll = 1;
> > > > > Query OK, 0 rows affected (0.00 sec)
> > > > > Rows matched: 1  Changed: 0  Warnings: 0
> > > > >
> > > > > mysql> update test set roll = 1, s = 'new' where roll = 17;
> > > > > Query OK, 0 rows affected (0.00 sec)
> > > > > Rows matched: 0  Changed: 0  Warnings: 0
> > > > >
> > > > > mysql> update test set roll = 1, s = 'neww' where roll = 1;
> > > > > Query OK, 1 row affected (0.00 sec)
> > > > > Rows matched: 1  Changed: 1  Warnings: 0
> > > > >
> > > > > --
> > > > > Cheers,
> > > > > Rajan
> > > > >
> > > >
> > > >
> > > > --------------------------------------------------------------
> > > > ------------------
> > > >
> > > >
> > > > No virus found in this incoming message.
> > > > Checked by AVG Free Edition.
> > > > Version: 7.5.472 / Virus Database: 269.8.13/843 - Release
> > > > Date: 6/10/2007
> > > > 1:39 PM
> > > >
> > > >
> > > > --
> > > > MySQL General Mailing List
> > > > For list archives: http://lists.mysql.com/mysql
> > > > To unsubscribe:
> > > > http://lists.mysql.com/[EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> >
>
>
> --
> - michael dykman
> - [EMAIL PROTECTED]
>
> - All models are wrong.  Some models are useful.
>


Reply via email to