문제

If I try to do an insert that fails because of a key constraint error, is there a way I can get the name of the key without doing string parsing of the error text?

I already know the error code is 1062; I want to find out which key constraint failed :)

도움이 되었습니까?

해결책

"without doing string parsing of the error text?" - No, as far as I know doing something like

preg_match("/for key '(.+)'$", $msg, $matches)

is your best chance.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top