Hi Simple.. The query "feedback" will depict the matched & changed numbers. 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
Thanks ViSolve DB Team. ----- Original Message ----- From: "Ace" <[EMAIL PROTECTED]> To: "ViSolve DB Team" <[EMAIL PROTECTED]> Cc: <mysql@lists.mysql.com> Sent: Monday, June 11, 2007 5:04 PM Subject: Re: how to get Number of rows matched? > Ok..thanks! But my problem here is how to check if there were any matched > rows when no rows were changed. mysql_affected_rows() will tell me the > affected rows. Simmly, is there any routine using which one can know if > there were any matched rows? > > Cheers, > Rajan > > On 6/11/07, ViSolve DB Team <[EMAIL PROTECTED]> wrote: >> >> 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" <[EMAIL PROTECTED]> >> To: <mysql@lists.mysql.com> >> 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 >> >> > -------------------------------------------------------------------------------- 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