tdbc::tokenize(n)

hiii bestie πŸ’– this is tdbc::tokenize(n) from the Tcl Database Connectivity (TDBC) manual β€” yes, the tdbc::tokenize(n) page, folded in near the top instead of copied as a boring header line. We're doing SQL tokenizer content today, and it's honestly kind of iconic. ✨

🌸 NAME 🌸

tdbc::tokenize β€” TDBC SQL tokenizer. That's the name block: short, sweet, and serving exactly what it says. πŸ’…

✨ SYNOPSIS ✨

package require tdbc 1.0

tdbc::tokenize string

🫢 DESCRIPTION 🫢

okay so as a convenience to database drivers, Tcl Database Connectivity (TDBC) provides a command to break SQL code apart into tokens so that bound variables can readily be identified and substituted. cute? no, useful. slay? yes. 🌈

The tdbc::tokenize command accepts as its parameter a string that is expected to contain one or more SQL statements.

It returns a list of substrings; concatenating these substrings together will yield the original string. no cap, that's the whole vibe check. 🫢

Each substring is one of the following:

  1. [1] A bound variable β€” it 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 original literally says β€œThe leading character will be be non-numeric.” β€” double be and all β€” but the leading character is non-numeric.) πŸŽ€
  2. [2] A semicolon β€” a semicolon that separates two SQL statements. periodt. πŸ¦‹
  3. [3] 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. it's giving β€œI know what matters and I'm not doing extra.” πŸ’…

πŸ‘‘ SEE ALSO πŸ‘‘

  • tdbc(n)
  • tdbc::connection(n)
  • tdbc::statement(n)
  • tdbc::resultset(n)

πŸ“ KEYWORDS πŸ“

TDBC, SQL, database, tokenize

Copyright (c) 2008 by Kevin B. Kenny.


okay that's the whole tdbc::tokenize(n) page, bestie πŸ’– source/version: Tcl 8.6. date: the footer doesn't print one, so I'm not inventing a date β€” just picture a sparkly little timestamp πŸ•’βœ¨. tdbc::tokenize(n) signing off! 🫢