Can I safely ignore MySQL HY000 error with error code 00000

I installed PHP (5.2) with PDO (MySQL 5.1) to throw exceptions when an error occurs:

$pdo = new PDO(...);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

Now I sometimes get an exception that only tells me "HY000: General Error". I tried to get more information from PDO, but all I can say is that:

  • errorInfo (): array(0 => 'HY000')
  • errorCode (): array(0 => '00000')

The request failure is as follows:

INSERT INTO user_values
SELECT user_id,
       attribute_id,
       ?,
       value 
  FROM user_values 
 WHERE user_id = ? 
   AND set_id = ?

I am sure that all cursors are properly closed ( $stmt->closeCursor()). An exception occurs when called fetchAll()in my application. After some searching, I found that some simply ignore this error, but it seems just wrong to reject the PDO exception.

? , " INSERT, , " ( INSERT, SELECT, UPDATE,...).

+3
1

00000 (, , ).

+5

Source: https://habr.com/ru/post/1793091/


All Articles