Hi Chetan,

Suppose I have a table :

mysql> select * from flag_test;
+--------+------+
| name   | flag |
+--------+------+
| Chetan | Y    |
+--------+------+
1 row in set (0.00 sec)

I am setting/unsetting the flag field from the api's ;

Now if the flag is already set and I executes the Query from the Mysql
Command prompt it shows :
MySQL> update flag_test set flag='Y' where name='chetan';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

but if the same Query I run from the C program and if I check the return
value of mysql_affected_rows(Mysql *) it returns 0 ,
Actually I am doing something based on it's return value but Instead of
Rows matched: 1


=The function only returns the number of rows "affected"/updated, not
the number of rows "matched" (in the WHERE clause). In this case, if the
flat was already "Y" (your interaction from the MySQL client), then the
C program will not have had a change to make - and not counted it as
"affected".

=Change the flag to non-Y, and then re-run the C prog.

=Regards,
=dn



---------------------------------------------------------------------
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to