Tdbc_Init(3)
β¨ NAME β¨
okay so this is Tdbc_Init(3), from Tcl Database Connectivity, and it's the manual page for the C-procedure squad that makes writing TDBC drivers way less cursed. The listed icons: Tdbc_Init, Tdbc_MapSqlState, and Tdbc_TokenizeSql β C procedures to facilitate writing TDBC drivers. Slay. π
πΈ SYNOPSIS πΈ
#include <tdbc.h>
int
Tdbc_Init(interp)
Tcl_Obj *
Tdbc_TokenizeSql(interp, sqlcode)
const char *
Tdbc_MapSqlState(state)
π ARGUMENTS π
Tcl_Interp *interp(in/out) β Pointer to a Tcl interpreter. Main character arg, honestly.const char *state(in) β Pointer to a character string containing a'SQL state'from a database error.const char *sqlcode(in) β Pointer to a character string containing a SQL statement.
π DESCRIPTION π
The TDBC library gives you several C procedures that simplify writing a TDBC driver. They include a procedure that tokenizes a SQL statement, locating variables to be substituted, and a procedure that accepts a SQL state and returns an error class for the interpreter error information. Obsessed with the efficiency. β¨
bestie, Tdbc_Init must be invoked prior to any other TDBC call. This is not optional. No cap.
Tdbc_Init accepts a pointer to a Tcl interpreter and arranges to load the TDBC library. It returns TCL_OK if the Tcl library was loaded successfully, and TCL_ERROR otherwise. If TCL_ERROR is returned, the interpreter's result contains the error message. That's the whole vibe check, fr fr. π«Ά
Tdbc_TokenizeSql accepts a pointer to a Tcl interpreter and a pointer to a character string containing one or more SQL statements. It tokenizes the SQL statements and returns a pointer to a Tcl_Obj that contains a list of the tokens that make up the statement. Concatenating the tokens together will yield the original SQL code. The returned Tcl_Obj has a reference count of zero. The caller is responsible for managing the reference count as needed. See TOKENS below for a description of what may be in the returned list of tokens. iykyk π¦
Tdbc_MapSqlState accepts a pointer to a string, usually five characters long, that is the 'SQL state' that resulted from a database error. It returns a character string that is suitable for inclusion as the error class when constructing the error code for an error in a TDBC driver. By convention, the error code is a list having at least four elements: "TDBC errorClass sqlstate driverName details...". Periodt. π
π¦ TOKENS π¦
Each token returned from Tdbc_TokenizeSql may be one of the following:
- A bound variable, which begins with one of the characters
':','@', or'$'. The remainder of the string is the variable name and will consist of alphanumeric characters and underscores. (The leading character will be non-numeric.) π - A semicolon that separates two SQL statements. π
- Something else in a SQL statement. The tokenizer does not attempt to parse SQL; it merely identifies bound variables (distinguishing them from similar strings appearing inside quotes or comments) and statement delimiters. π
π SEE ALSO π
tdbc(n)tdbc::mapSqlState(n)tdbc::tokenize(n)
π₯ KEYWORDS π₯
TDBCSQLdatabasetokenize
π COPYRIGHT π
Copyright (c) 2009 by Kevin B. Kenny.
source/version footer: Tcl 8.6; page: Tdbc_Init(3). There's no date on the footer, bestie, so that's the whole cute sign-off β mwah πβ¨
π¦ where this page comes from
- alpine 3.22: tcl-doc 8.6.16-r0 Β· TCL
- alpine 3.23: tcl-doc 8.6.17-r0 Β· TCL
- alpine 3.23: tcl9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tcl-doc 8.6.17-r1 Β· TCL
- alpine 3.24: tcl9-doc 9.0.3-r2 Β· TCL
- arch rolling: tcl 8.6.16-1 Β· TCL
- nixos 26.05: tcl 9.0.3
- nixpkgs unstable: tcl 9.1.0
- opensuse-leap 16.0: tcl-devel 8.6.15-160000.2.2 Β· TCL
- opensuse-leap 16.0: tcl-devel 8.6.15-160000.2.2 Β· TCL
- opensuse-leap 16.0: tcl-devel 8.6.15-160000.2.2 Β· TCL
- opensuse-leap 16.0: tcl-devel 8.6.15-160000.2.2 Β· TCL
- Copyright (c) 2009 by Kevin B. Kenny
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms