On Wed, 8 Apr 2009, Pete Wilson wrote:
Hi everyone --
I'm a MySQL noob. I have MySQL queries in my C code and I was surprised
to find I'm getting a success return from:
mysql_query(pmysql, select * from usrs where(usr=\illegal name\);
In this table called usrs, usr is the primary key and the engine is
myisam. I expected an error return from this query on illegal name,
which is not in the table.
An error is not returned until I call:
prow = mysql_fetch_row(pmysqlres));
which returns NULL, which is great.
If I run that same select from the command line, I see:
mysql select * from usrs where (usr=illegal name);
Empty set (0.00 sec)
My question, finally: Is this response to my program call expected and
normal for MySQL? I suppose it is, but I just want to make sure that the
behavior is OK, that indeed the program call to mysql_query(select ...)
must always in these circumstances return success.
Thanks!
-- Pete Wilson
Hi Pete
I suspect that illegal name means that this value is not existing in the
table. Right?
But this query is perfectly correct and should not throw an error. It's
like
select * from table where 1 = 0;
which returns nothing, the correct answer.
Tom
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org