Q: error numbers and mysql versions

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


I need to detect duplicate errors when using mysql to insert a row in a
php program. (I assume that the php version should not make a difference,
but I don't know that for sure, which is why I mention php.)

I am using mysql_error() and mysql_errno() - no problem there, but my
question concerns the values they return in different versions of mysql.

With my versions the errno is 1062, and the error string contains the word

But what will they return if the versions should change?

What is the most reliable way to detect the duplicate error that will
still work if the versions change?

Will the errno remain constant for different versions of mysql?

If not, then what is the best way to handle this, is there a library of
error constants?

Feedback welcome, thanks.


This space not for rent.

Re: Q: error numbers and mysql versions

Malcolm Dew-Jones wrote:
Quoted text here. Click to load it

SQLSTATE values are defined by the SQL standard, so perhaps that's most
likely to remain constant.  SQLSTATE is supported in MySQL 4.1 and later.

Quoted text here. Click to load it

Does this help?

Bill K.

Site Timeline