我最近搜索了获取数据库操作导致的错误的可能性。在 MySQL 5.6 和 MariaDB 10 中,这可以通过
GET DIAGNOSTICS
命令。对应的例子是
GET DIAGNOSTICS CONDITION 1 @p1 = RETURNED_SQLSTATE, @p2 = MESSAGE_TEXT
但是 MariaDB 抛出一个错误
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'GET
DIAGNOSTICS CONDITION 1
@p1 = RETURNED_SQLSTATE, @p2 = MESSAGE_TEXT' at line 1
我已经检查了版本,我有 10.0.3-MariaDB
在此先感谢您的帮助
加布里埃尔