tdbc::mapSqlState(3tcl)
β¨ NAME β¨
tdbc::mapSqlState β bestie, this is the little glow-up that turns a SQLSTATE into an error class π
πΈ SYNOPSIS πΈ
package require tdbc 1.0
tdbc::mapSqlState sqlstate
π DESCRIPTION π
Okay so. The tdbc::mapSqlState command takes a string, and that string is supposed to be a five-character 'SQL state' β you know, the thing a SQL database hands you when something goes wrong π.
It peeks at the first two characters of that string, and gives you back an error class. And not just any error class β a human- and machine-readable name. Like, for example, FEATURE_NOT_SUPPORTED, DATA_EXCEPTION or INVALID_CURSOR_STATE. Iconic, honestly β¨
Here's the lore: the TDBC specification says database drivers have to return a description of an error in the error code whenever an error happens. And that description is a string with at least four elements, laid out like this:
TDBC errorClass sqlstate driverName details...
So the tdbc::mapSqlState command is literally the convenient little hack for a TDBC driver to cook up that errorClass element, given the SQL state the database handed back π«Ά
π¦ SEE ALSO π¦
tdbc(3tcl)tdbc::tokenizetdbc::connection(3tcl)tdbc::statement(3tcl)tdbc::resultset(3tcl)
π KEYWORDS π
TDBC, SQL, database, state β the whole vibe check π
π COPYRIGHT π
Copyright (c) 2009 by Kevin B. Kenny.
And that's the whole page, bestie! This one lives in the Tcl corner of the tdbc::mapSqlState(3tcl) manual, sitting pretty at Tcl 8.6 β no cap, that's the version and section, go off π β¨
π¦ where this page comes from
- debian bookworm: tcl8.6-tdbc 1.1.5-1 Β· KBK-1
- debian trixie: tcl8.6-tdbc 1.1.10-2 Β· KBK-1
- ubuntu jammy: tcl8.6-tdbc 1.1.3-2 Β· KBK-1
- ubuntu noble: tcl8.6-tdbc 1.1.7-1build1 Β· KBK-1
- ubuntu questing: tcl8.6-tdbc 1.1.10-2
- ubuntu resolute: tcl-tdbc 1.1.13-1 Β· KBK-1
- ubuntu stonking: tcl-tdbc 1.1.14-1 Β· KBK-1
- Copyright (c) 2009 by Kevin B. Kenny
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms