At 8:13 PM +0100 5/3/01, VVM Ravikumar Sarma Chengalvala wrote:
>Hi,
>1.
>I am using C_API for accessing data from MYSQL.
>2.
>mysql_query() function returns the following values:
>0 if the query is successful
>-1 if the query fails.
No. It returns 0 if the query is successful and NON-ZERO if it
fails. You cannot count on the non-zero value being -1.
>3.
>At the same time mysql-C_API documentation specifies
>that it returns a non zero number if query is a
>failure.Does the function return any other values
>other than -1 if the query fails?
Don't test for -1. Test for non-zero.
>4.
>If I use the mysql_query() for INSERT or UPDATE
>statements I am facing the following problem:
>If the database column value I am trying to update is
>the same as the the value already existing in the
>database,then the mysql_query() returns 0 and the
>mysql_affected_rows() returns zero.
>
>It will be good if mysql_query either returns -1 for
>this case as the value being updated is same as that
>of existing one.
Try setting the CLIENT_FOUND_ROWS option in your mysql_real_connect()
call when you connect to the server and see what happens..
>
>Regards,
>Ravi
--
Paul DuBois, [EMAIL PROTECTED]
---------------------------------------------------------------------
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