tdbc::tokenize(3tcl)
β¨ NAME β¨
tdbc::tokenize β the TDBC SQL tokenizer, bestie π
okay so quick vibe check: this page is from the Tcl Database Connectivity manual, and it's literally about chopping SQL into lil pieces so your database driver can spot its bound variables. slay.
πΈ SYNOPSIS πΈ
package require tdbc 1.0
tdbc::tokenize string
π DESCRIPTION π
so basically, TDBC (that's Tcl Database Connectivity, iykyk) is out here doing a solid for database drivers: it gives you a command that breaks your SQL code apart into tokens, so bound variables can get identified and substituted without anyone breaking a sweat. it's giving helpful fr fr.
tdbc::tokenize takes one parameter β a string β and that string is expected to contain one or more SQL statements. it hands you back a list of substrings, and here's the iconic part: if you concatenate all those substrings back together, you get the original string. no cap. nothing lost, nothing invented. π
every single substring it gives you is one of these three things:
- A bound variable π₯ β it starts with one of the characters
':','@', or'$'. everything after that leading character is the variable name, and that name is made of alphanumeric characters and underscores. (the leading character is non-numeric, just so we're clear.) periodt. - A semicolon π«Ά β specifically a semicolon that separates two SQL statements.
- Something else in a SQL statement β¨ β and ngl, this is the important disclaimer: the tokenizer does not attempt to parse SQL. it's not doing all that. it merely identifies bound variables (and yes, it's smart enough to tell them apart from similar-looking strings that show up inside quotes or comments π) plus statement delimiters. that's it, that's the job.
bestie, don't expect a full SQL parser from this. it's a tokenizer with one very specific main character job: bound variables + statement delimiters. π
π¦ SEE ALSO π¦
tdbc(3tcl)tdbc::connection(3tcl)tdbc::statement(3tcl)tdbc::resultset(3tcl)
β KEYWORDS β
TDBC, SQL, database, tokenize
π COPYRIGHT π
Copyright (c) 2008 by Kevin B. Kenny.
and that's the whole page, bestie π β brought to you by the Tcl manual, version 8.6, filed under tdbc::tokenize(3tcl). go tokenize something cute β¨π
π¦ 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) 2008 by Kevin B. Kenny
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms