Ticket Hash: | 3eaf36b1491ec71d3542927ee3d387bc07b09370 | ||
Title: | Get the sql error code | ||
Status: | Open | Type: | Feature_Request |
Severity: | Important | Priority: | Immediate |
Subsystem: | not_specified | Resolution: | Open |
Last Modified: | 2025-03-30 02:05:55 | ||
Version Found In: |
User Comments: | ||||
anonymous added on 2025-03-29 01:47:31:
The messages retrieved from transactions are very comprehensive information for the programmer, but for the purposes of a practical interface, that's too much information for the end user. It's more useful to be able to retrieve the SQL error and customize the error message accordingly (including modifying the language, for example). Alejandro chw added on 2025-03-29 06:15:22: From my understanding of the tdcb::mysql internal functions TransferMysqlError() and TransferMysqlStmtError() the Tcl errorCode variable receives a list which has the SQLSTATE string and the MySQL native error code at index 2 and 4, respectively. Thus, customization should be possible using this information and associate it according to this table https://mariadb.com/kb/en/mariadb-error-code-reference/ anonymous added on 2025-03-30 02:05:55: That's the answer!. As you said, i could extract this info from the variable $::errorCode. I read the documentation several times, including the paragraph about the tdbc::mapSqlState command, which says: "The TDBC specification requires database drivers to return a description of an error in the error code when an error occurs." But I didn't interpret "the error code" as the $::errorCode variable (i suggest modifying this in the documentation to make it more explicit). Thanks. Alejandro |