add python dependencies
This commit is contained in:
26
.CondaPkg/env/Library/lib/tdbc1.1.5/pkgIndex.tcl
vendored
Normal file
26
.CondaPkg/env/Library/lib/tdbc1.1.5/pkgIndex.tcl
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# -*- tcl -*-
|
||||
# Tcl package index file, version 1.1
|
||||
#
|
||||
# Make sure that TDBC is running in a compatible version of Tcl, and
|
||||
# that TclOO is available.
|
||||
|
||||
if {![package vsatisfies [package provide Tcl] 8.6-]} {
|
||||
return
|
||||
}
|
||||
apply {{dir} {
|
||||
set libraryfile [file join $dir tdbc.tcl]
|
||||
if {![file exists $libraryfile] && [info exists ::env(TDBC_LIBRARY)]} {
|
||||
set libraryfile [file join $::env(TDBC_LIBRARY) tdbc.tcl]
|
||||
}
|
||||
if {[package vsatisfies [package provide Tcl] 9.0-]} {
|
||||
package ifneeded tdbc 1.1.5 \
|
||||
"package require TclOO;\
|
||||
[list load [file join $dir tcl9tdbc115t.dll] [string totitle tdbc]]\;\
|
||||
[list source $libraryfile]"
|
||||
} else {
|
||||
package ifneeded tdbc 1.1.5 \
|
||||
"package require TclOO;\
|
||||
[list load [file join $dir tdbc115t.dll] [string totitle tdbc]]\;\
|
||||
[list source $libraryfile]"
|
||||
}
|
||||
}} $dir
|
||||
86
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc.n
vendored
Normal file
86
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc.n
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
'\"
|
||||
'\" tdbc.n --
|
||||
'\"
|
||||
'\" Copyright (c) 2008 by Kevin B. Kenny.
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution of
|
||||
'\" this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
.TH "tdbc" n 8.6 Tcl "Tcl Database Connectivity"
|
||||
'\" .so man.macros
|
||||
'\" IGNORE
|
||||
.if t .wh -1.3i ^B
|
||||
.nr ^l \n(.l
|
||||
.ad b
|
||||
'\" # BS - start boxed text
|
||||
'\" # ^y = starting y location
|
||||
'\" # ^b = 1
|
||||
.de BS
|
||||
.br
|
||||
.mk ^y
|
||||
.nr ^b 1u
|
||||
.if n .nf
|
||||
.if n .ti 0
|
||||
.if n \l'\\n(.lu\(ul'
|
||||
.if n .fi
|
||||
..
|
||||
'\" # BE - end boxed text (draw box now)
|
||||
.de BE
|
||||
.nf
|
||||
.ti 0
|
||||
.mk ^t
|
||||
.ie n \l'\\n(^lu\(ul'
|
||||
.el \{\
|
||||
'\" Draw four-sided box normally, but don't draw top of
|
||||
'\" box if the box started on an earlier page.
|
||||
.ie !\\n(^b-1 \{\
|
||||
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
|
||||
.\}
|
||||
.el \}\
|
||||
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
|
||||
.\}
|
||||
.\}
|
||||
.fi
|
||||
.br
|
||||
.nr ^b 0
|
||||
..
|
||||
'\" END IGNORE
|
||||
.BS
|
||||
.SH "NAME"
|
||||
tdbc \- Tcl Database Connectivity
|
||||
.SH "SYNOPSIS"
|
||||
.nf
|
||||
package require \fBtdbc 1.0\fR
|
||||
package require \fBtdbc::\fIdriver version\fR
|
||||
|
||||
\fBtdbc::\fIdriver\fB::connection create \fIdb\fR ?\fI\-option value\fR...?
|
||||
.fi
|
||||
.BE
|
||||
.SH "DESCRIPTION"
|
||||
.PP
|
||||
Tcl Database Connectivity (TDBC) is a common interface for Tcl
|
||||
programs to access SQL databases. It is implemented by a series of
|
||||
database \fIdrivers\fR: separate modules, each of which adapts Tcl to
|
||||
the interface of one particular database system. All of the drivers
|
||||
implement a common series of commands for manipulating the database.
|
||||
These commands are all named dynamically, since they all represent
|
||||
objects in the database system. They include \fBconnections,\fR
|
||||
which represent connections to a database; \fBstatements,\fR which
|
||||
represent SQL statements, and \fBresult sets,\fR which represent
|
||||
the sets of rows that result from executing statements. All of these
|
||||
have manual pages of their own, listed under \fBSEE ALSO\fR.
|
||||
.PP
|
||||
In addition, TDBC itself has a few service procedures that are chiefly
|
||||
of interest to driver writers. \fBSEE ALSO\fR also enumerates them.
|
||||
.SH "SEE ALSO"
|
||||
Tdbc_Init(3),
|
||||
tdbc::connection(n), tdbc::mapSqlState(n),
|
||||
tdbc::resultset(n), tdbc::statement(n), tdbc::tokenize(n),
|
||||
tdbc::mysql(n), tdbc::odbc(n), tdbc::postgres(n), tdbc::sqlite3(n)
|
||||
.SH "KEYWORDS"
|
||||
TDBC, SQL, database, connectivity, connection, resultset, statement
|
||||
.SH "COPYRIGHT"
|
||||
Copyright (c) 2008 by Kevin B. Kenny.
|
||||
'\" Local Variables:
|
||||
'\" mode: nroff
|
||||
'\" End:
|
||||
'\"
|
||||
922
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc.tcl
vendored
Normal file
922
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc.tcl
vendored
Normal file
@@ -0,0 +1,922 @@
|
||||
# tdbc.tcl --
|
||||
#
|
||||
# Definitions of base classes from which TDBC drivers' connections,
|
||||
# statements and result sets may inherit.
|
||||
#
|
||||
# Copyright (c) 2008 by Kevin B. Kenny
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
# RCS: @(#) $Id$
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
package require TclOO
|
||||
|
||||
namespace eval ::tdbc {
|
||||
namespace export connection statement resultset
|
||||
variable generalError [list TDBC GENERAL_ERROR HY000 {}]
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# tdbc::ParseConvenienceArgs --
|
||||
#
|
||||
# Parse the convenience arguments to a TDBC 'execute',
|
||||
# 'executewithdictionary', or 'foreach' call.
|
||||
#
|
||||
# Parameters:
|
||||
# argv - Arguments to the call
|
||||
# optsVar -- Name of a variable in caller's scope that will receive
|
||||
# a dictionary of the supplied options
|
||||
#
|
||||
# Results:
|
||||
# Returns any args remaining after parsing the options.
|
||||
#
|
||||
# Side effects:
|
||||
# Sets the 'opts' dictionary to the options.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
proc tdbc::ParseConvenienceArgs {argv optsVar} {
|
||||
|
||||
variable generalError
|
||||
upvar 1 $optsVar opts
|
||||
|
||||
set opts [dict create -as dicts]
|
||||
set i 0
|
||||
|
||||
# Munch keyword options off the front of the command arguments
|
||||
|
||||
foreach {key value} $argv {
|
||||
if {[string index $key 0] eq {-}} {
|
||||
switch -regexp -- $key {
|
||||
-as? {
|
||||
if {$value ne {dicts} && $value ne {lists}} {
|
||||
set errorcode $generalError
|
||||
lappend errorcode badVarType $value
|
||||
return -code error \
|
||||
-errorcode $errorcode \
|
||||
"bad variable type \"$value\":\
|
||||
must be lists or dicts"
|
||||
}
|
||||
dict set opts -as $value
|
||||
}
|
||||
-c(?:o(?:l(?:u(?:m(?:n(?:s(?:v(?:a(?:r(?:i(?:a(?:b(?:le?)?)?)?)?)?)?)?)?)?)?)?)?) {
|
||||
dict set opts -columnsvariable $value
|
||||
}
|
||||
-- {
|
||||
incr i
|
||||
break
|
||||
}
|
||||
default {
|
||||
set errorcode $generalError
|
||||
lappend errorcode badOption $key
|
||||
return -code error \
|
||||
-errorcode $errorcode \
|
||||
"bad option \"$key\":\
|
||||
must be -as or -columnsvariable"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break
|
||||
}
|
||||
incr i 2
|
||||
}
|
||||
|
||||
return [lrange $argv[set argv {}] $i end]
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# tdbc::connection --
|
||||
#
|
||||
# Class that represents a generic connection to a database.
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
oo::class create ::tdbc::connection {
|
||||
|
||||
# statementSeq is the sequence number of the last statement created.
|
||||
# statementClass is the name of the class that implements the
|
||||
# 'statement' API.
|
||||
# primaryKeysStatement is the statement that queries primary keys
|
||||
# foreignKeysStatement is the statement that queries foreign keys
|
||||
|
||||
variable statementSeq primaryKeysStatement foreignKeysStatement
|
||||
|
||||
# The base class constructor accepts no arguments. It sets up the
|
||||
# machinery to do the bookkeeping to keep track of what statements
|
||||
# are associated with the connection. The derived class constructor
|
||||
# is expected to set the variable, 'statementClass' to the name
|
||||
# of the class that represents statements, so that the 'prepare'
|
||||
# method can invoke it.
|
||||
|
||||
constructor {} {
|
||||
set statementSeq 0
|
||||
namespace eval Stmt {}
|
||||
}
|
||||
|
||||
# The 'close' method is simply an alternative syntax for destroying
|
||||
# the connection.
|
||||
|
||||
method close {} {
|
||||
my destroy
|
||||
}
|
||||
|
||||
# The 'prepare' method creates a new statement against the connection,
|
||||
# giving its constructor the current statement and the SQL code to
|
||||
# prepare. It uses the 'statementClass' variable set by the constructor
|
||||
# to get the class to instantiate.
|
||||
|
||||
method prepare {sqlcode} {
|
||||
return [my statementCreate Stmt::[incr statementSeq] [self] $sqlcode]
|
||||
}
|
||||
|
||||
# The 'statementCreate' method delegates to the constructor
|
||||
# of the class specified by the 'statementClass' variable. It's
|
||||
# intended for drivers designed before tdbc 1.0b10. Current ones
|
||||
# should forward this method to the constructor directly.
|
||||
|
||||
method statementCreate {name instance sqlcode} {
|
||||
my variable statementClass
|
||||
return [$statementClass create $name $instance $sqlcode]
|
||||
}
|
||||
|
||||
# Derived classes are expected to implement the 'prepareCall' method,
|
||||
# and have it call 'prepare' as needed (or do something else and
|
||||
# install the resulting statement)
|
||||
|
||||
# The 'statements' method lists the statements active against this
|
||||
# connection.
|
||||
|
||||
method statements {} {
|
||||
info commands Stmt::*
|
||||
}
|
||||
|
||||
# The 'resultsets' method lists the result sets active against this
|
||||
# connection.
|
||||
|
||||
method resultsets {} {
|
||||
set retval {}
|
||||
foreach statement [my statements] {
|
||||
foreach resultset [$statement resultsets] {
|
||||
lappend retval $resultset
|
||||
}
|
||||
}
|
||||
return $retval
|
||||
}
|
||||
|
||||
# The 'transaction' method executes a block of Tcl code as an
|
||||
# ACID transaction against the database.
|
||||
|
||||
method transaction {script} {
|
||||
my begintransaction
|
||||
set status [catch {uplevel 1 $script} result options]
|
||||
if {$status in {0 2 3 4}} {
|
||||
set status2 [catch {my commit} result2 options2]
|
||||
if {$status2 == 1} {
|
||||
set status 1
|
||||
set result $result2
|
||||
set options $options2
|
||||
}
|
||||
}
|
||||
switch -exact -- $status {
|
||||
0 {
|
||||
# do nothing
|
||||
}
|
||||
2 - 3 - 4 {
|
||||
set options [dict merge {-level 1} $options[set options {}]]
|
||||
dict incr options -level
|
||||
}
|
||||
default {
|
||||
my rollback
|
||||
}
|
||||
}
|
||||
return -options $options $result
|
||||
}
|
||||
|
||||
# The 'allrows' method prepares a statement, then executes it with
|
||||
# a given set of substituents, returning a list of all the rows
|
||||
# that the statement returns. Optionally, it stores the names of
|
||||
# the columns in '-columnsvariable'.
|
||||
# Usage:
|
||||
# $db allrows ?-as lists|dicts? ?-columnsvariable varName? ?--?
|
||||
# sql ?dictionary?
|
||||
|
||||
method allrows args {
|
||||
|
||||
variable ::tdbc::generalError
|
||||
|
||||
# Grab keyword-value parameters
|
||||
|
||||
set args [::tdbc::ParseConvenienceArgs $args[set args {}] opts]
|
||||
|
||||
# Check postitional parameters
|
||||
|
||||
set cmd [list [self] prepare]
|
||||
if {[llength $args] == 1} {
|
||||
set sqlcode [lindex $args 0]
|
||||
} elseif {[llength $args] == 2} {
|
||||
lassign $args sqlcode dict
|
||||
} else {
|
||||
set errorcode $generalError
|
||||
lappend errorcode wrongNumArgs
|
||||
return -code error -errorcode $errorcode \
|
||||
"wrong # args: should be [lrange [info level 0] 0 1]\
|
||||
?-option value?... ?--? sqlcode ?dictionary?"
|
||||
}
|
||||
lappend cmd $sqlcode
|
||||
|
||||
# Prepare the statement
|
||||
|
||||
set stmt [uplevel 1 $cmd]
|
||||
|
||||
# Delegate to the statement to accumulate the results
|
||||
|
||||
set cmd [list $stmt allrows {*}$opts --]
|
||||
if {[info exists dict]} {
|
||||
lappend cmd $dict
|
||||
}
|
||||
set status [catch {
|
||||
uplevel 1 $cmd
|
||||
} result options]
|
||||
|
||||
# Destroy the statement
|
||||
|
||||
catch {
|
||||
$stmt close
|
||||
}
|
||||
|
||||
return -options $options $result
|
||||
}
|
||||
|
||||
# The 'foreach' method prepares a statement, then executes it with
|
||||
# a supplied set of substituents. For each row of the result,
|
||||
# it sets a variable to the row and invokes a script in the caller's
|
||||
# scope.
|
||||
#
|
||||
# Usage:
|
||||
# $db foreach ?-as lists|dicts? ?-columnsVariable varName? ?--?
|
||||
# varName sql ?dictionary? script
|
||||
|
||||
method foreach args {
|
||||
|
||||
variable ::tdbc::generalError
|
||||
|
||||
# Grab keyword-value parameters
|
||||
|
||||
set args [::tdbc::ParseConvenienceArgs $args[set args {}] opts]
|
||||
|
||||
# Check postitional parameters
|
||||
|
||||
set cmd [list [self] prepare]
|
||||
if {[llength $args] == 3} {
|
||||
lassign $args varname sqlcode script
|
||||
} elseif {[llength $args] == 4} {
|
||||
lassign $args varname sqlcode dict script
|
||||
} else {
|
||||
set errorcode $generalError
|
||||
lappend errorcode wrongNumArgs
|
||||
return -code error -errorcode $errorcode \
|
||||
"wrong # args: should be [lrange [info level 0] 0 1]\
|
||||
?-option value?... ?--? varname sqlcode ?dictionary? script"
|
||||
}
|
||||
lappend cmd $sqlcode
|
||||
|
||||
# Prepare the statement
|
||||
|
||||
set stmt [uplevel 1 $cmd]
|
||||
|
||||
# Delegate to the statement to iterate over the results
|
||||
|
||||
set cmd [list $stmt foreach {*}$opts -- $varname]
|
||||
if {[info exists dict]} {
|
||||
lappend cmd $dict
|
||||
}
|
||||
lappend cmd $script
|
||||
set status [catch {
|
||||
uplevel 1 $cmd
|
||||
} result options]
|
||||
|
||||
# Destroy the statement
|
||||
|
||||
catch {
|
||||
$stmt close
|
||||
}
|
||||
|
||||
# Adjust return level in the case that the script [return]s
|
||||
|
||||
if {$status == 2} {
|
||||
set options [dict merge {-level 1} $options[set options {}]]
|
||||
dict incr options -level
|
||||
}
|
||||
return -options $options $result
|
||||
}
|
||||
|
||||
# The 'BuildPrimaryKeysStatement' method builds a SQL statement to
|
||||
# retrieve the primary keys from a database. (It executes once the
|
||||
# first time the 'primaryKeys' method is executed, and retains the
|
||||
# prepared statement for reuse.)
|
||||
|
||||
method BuildPrimaryKeysStatement {} {
|
||||
|
||||
# On some databases, CONSTRAINT_CATALOG is always NULL and
|
||||
# JOINing to it fails. Check for this case and include that
|
||||
# JOIN only if catalog names are supplied.
|
||||
|
||||
set catalogClause {}
|
||||
if {[lindex [set count [my allrows -as lists {
|
||||
SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
|
||||
WHERE CONSTRAINT_CATALOG IS NOT NULL}]] 0 0] != 0} {
|
||||
set catalogClause \
|
||||
{AND xtable.CONSTRAINT_CATALOG = xcolumn.CONSTRAINT_CATALOG}
|
||||
}
|
||||
set primaryKeysStatement [my prepare "
|
||||
SELECT xtable.TABLE_SCHEMA AS \"tableSchema\",
|
||||
xtable.TABLE_NAME AS \"tableName\",
|
||||
xtable.CONSTRAINT_CATALOG AS \"constraintCatalog\",
|
||||
xtable.CONSTRAINT_SCHEMA AS \"constraintSchema\",
|
||||
xtable.CONSTRAINT_NAME AS \"constraintName\",
|
||||
xcolumn.COLUMN_NAME AS \"columnName\",
|
||||
xcolumn.ORDINAL_POSITION AS \"ordinalPosition\"
|
||||
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS xtable
|
||||
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE xcolumn
|
||||
ON xtable.CONSTRAINT_SCHEMA = xcolumn.CONSTRAINT_SCHEMA
|
||||
AND xtable.TABLE_NAME = xcolumn.TABLE_NAME
|
||||
AND xtable.CONSTRAINT_NAME = xcolumn.CONSTRAINT_NAME
|
||||
$catalogClause
|
||||
WHERE xtable.TABLE_NAME = :tableName
|
||||
AND xtable.CONSTRAINT_TYPE = 'PRIMARY KEY'
|
||||
"]
|
||||
}
|
||||
|
||||
# The default implementation of the 'primarykeys' method uses the
|
||||
# SQL INFORMATION_SCHEMA to retrieve primary key information. Databases
|
||||
# that might not have INFORMATION_SCHEMA must overload this method.
|
||||
|
||||
method primarykeys {tableName} {
|
||||
if {![info exists primaryKeysStatement]} {
|
||||
my BuildPrimaryKeysStatement
|
||||
}
|
||||
tailcall $primaryKeysStatement allrows [list tableName $tableName]
|
||||
}
|
||||
|
||||
# The 'BuildForeignKeysStatements' method builds a SQL statement to
|
||||
# retrieve the foreign keys from a database. (It executes once the
|
||||
# first time the 'foreignKeys' method is executed, and retains the
|
||||
# prepared statements for reuse.)
|
||||
|
||||
method BuildForeignKeysStatement {} {
|
||||
|
||||
# On some databases, CONSTRAINT_CATALOG is always NULL and
|
||||
# JOINing to it fails. Check for this case and include that
|
||||
# JOIN only if catalog names are supplied.
|
||||
|
||||
set catalogClause1 {}
|
||||
set catalogClause2 {}
|
||||
if {[lindex [set count [my allrows -as lists {
|
||||
SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
|
||||
WHERE CONSTRAINT_CATALOG IS NOT NULL}]] 0 0] != 0} {
|
||||
set catalogClause1 \
|
||||
{AND fkc.CONSTRAINT_CATALOG = rc.CONSTRAINT_CATALOG}
|
||||
set catalogClause2 \
|
||||
{AND pkc.CONSTRAINT_CATALOG = rc.CONSTRAINT_CATALOG}
|
||||
}
|
||||
|
||||
foreach {exists1 clause1} {
|
||||
0 {}
|
||||
1 { AND pkc.TABLE_NAME = :primary}
|
||||
} {
|
||||
foreach {exists2 clause2} {
|
||||
0 {}
|
||||
1 { AND fkc.TABLE_NAME = :foreign}
|
||||
} {
|
||||
set stmt [my prepare "
|
||||
SELECT rc.CONSTRAINT_CATALOG AS \"foreignConstraintCatalog\",
|
||||
rc.CONSTRAINT_SCHEMA AS \"foreignConstraintSchema\",
|
||||
rc.CONSTRAINT_NAME AS \"foreignConstraintName\",
|
||||
rc.UNIQUE_CONSTRAINT_CATALOG
|
||||
AS \"primaryConstraintCatalog\",
|
||||
rc.UNIQUE_CONSTRAINT_SCHEMA AS \"primaryConstraintSchema\",
|
||||
rc.UNIQUE_CONSTRAINT_NAME AS \"primaryConstraintName\",
|
||||
rc.UPDATE_RULE AS \"updateAction\",
|
||||
rc.DELETE_RULE AS \"deleteAction\",
|
||||
pkc.TABLE_CATALOG AS \"primaryCatalog\",
|
||||
pkc.TABLE_SCHEMA AS \"primarySchema\",
|
||||
pkc.TABLE_NAME AS \"primaryTable\",
|
||||
pkc.COLUMN_NAME AS \"primaryColumn\",
|
||||
fkc.TABLE_CATALOG AS \"foreignCatalog\",
|
||||
fkc.TABLE_SCHEMA AS \"foreignSchema\",
|
||||
fkc.TABLE_NAME AS \"foreignTable\",
|
||||
fkc.COLUMN_NAME AS \"foreignColumn\",
|
||||
pkc.ORDINAL_POSITION AS \"ordinalPosition\"
|
||||
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc
|
||||
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE fkc
|
||||
ON fkc.CONSTRAINT_NAME = rc.CONSTRAINT_NAME
|
||||
AND fkc.CONSTRAINT_SCHEMA = rc.CONSTRAINT_SCHEMA
|
||||
$catalogClause1
|
||||
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE pkc
|
||||
ON pkc.CONSTRAINT_NAME = rc.UNIQUE_CONSTRAINT_NAME
|
||||
AND pkc.CONSTRAINT_SCHEMA = rc.UNIQUE_CONSTRAINT_SCHEMA
|
||||
$catalogClause2
|
||||
AND pkc.ORDINAL_POSITION = fkc.ORDINAL_POSITION
|
||||
WHERE 1=1
|
||||
$clause1
|
||||
$clause2
|
||||
ORDER BY \"foreignConstraintCatalog\", \"foreignConstraintSchema\", \"foreignConstraintName\", \"ordinalPosition\"
|
||||
"]
|
||||
dict set foreignKeysStatement $exists1 $exists2 $stmt
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# The default implementation of the 'foreignkeys' method uses the
|
||||
# SQL INFORMATION_SCHEMA to retrieve primary key information. Databases
|
||||
# that might not have INFORMATION_SCHEMA must overload this method.
|
||||
|
||||
method foreignkeys {args} {
|
||||
|
||||
variable ::tdbc::generalError
|
||||
|
||||
# Check arguments
|
||||
|
||||
set argdict {}
|
||||
if {[llength $args] % 2 != 0} {
|
||||
set errorcode $generalError
|
||||
lappend errorcode wrongNumArgs
|
||||
return -code error -errorcode $errorcode \
|
||||
"wrong # args: should be [lrange [info level 0] 0 1]\
|
||||
?-option value?..."
|
||||
}
|
||||
foreach {key value} $args {
|
||||
if {$key ni {-primary -foreign}} {
|
||||
set errorcode $generalError
|
||||
lappend errorcode badOption
|
||||
return -code error -errorcode $errorcode \
|
||||
"bad option \"$key\", must be -primary or -foreign"
|
||||
}
|
||||
set key [string range $key 1 end]
|
||||
if {[dict exists $argdict $key]} {
|
||||
set errorcode $generalError
|
||||
lappend errorcode dupOption
|
||||
return -code error -errorcode $errorcode \
|
||||
"duplicate option \"$key\" supplied"
|
||||
}
|
||||
dict set argdict $key $value
|
||||
}
|
||||
|
||||
# Build the statements that query foreign keys. There are four
|
||||
# of them, one for each combination of whether -primary
|
||||
# and -foreign is specified.
|
||||
|
||||
if {![info exists foreignKeysStatement]} {
|
||||
my BuildForeignKeysStatement
|
||||
}
|
||||
set stmt [dict get $foreignKeysStatement \
|
||||
[dict exists $argdict primary] \
|
||||
[dict exists $argdict foreign]]
|
||||
tailcall $stmt allrows $argdict
|
||||
}
|
||||
|
||||
# Derived classes are expected to implement the 'begintransaction',
|
||||
# 'commit', and 'rollback' methods.
|
||||
|
||||
# Derived classes are expected to implement 'tables' and 'columns' method.
|
||||
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Class: tdbc::statement
|
||||
#
|
||||
# Class that represents a SQL statement in a generic database
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
oo::class create tdbc::statement {
|
||||
|
||||
# resultSetSeq is the sequence number of the last result set created.
|
||||
# resultSetClass is the name of the class that implements the 'resultset'
|
||||
# API.
|
||||
|
||||
variable resultSetClass resultSetSeq
|
||||
|
||||
# The base class constructor accepts no arguments. It initializes
|
||||
# the machinery for tracking the ownership of result sets. The derived
|
||||
# constructor is expected to invoke the base constructor, and to
|
||||
# set a variable 'resultSetClass' to the fully-qualified name of the
|
||||
# class that represents result sets.
|
||||
|
||||
constructor {} {
|
||||
set resultSetSeq 0
|
||||
namespace eval ResultSet {}
|
||||
}
|
||||
|
||||
# The 'execute' method on a statement runs the statement with
|
||||
# a particular set of substituted variables. It actually works
|
||||
# by creating the result set object and letting that objects
|
||||
# constructor do the work of running the statement. The creation
|
||||
# is wrapped in an [uplevel] call because the substitution proces
|
||||
# may need to access variables in the caller's scope.
|
||||
|
||||
# WORKAROUND: Take out the '0 &&' from the next line when
|
||||
# Bug 2649975 is fixed
|
||||
if {0 && [package vsatisfies [package provide Tcl] 8.6]} {
|
||||
method execute args {
|
||||
tailcall my resultSetCreate \
|
||||
[namespace current]::ResultSet::[incr resultSetSeq] \
|
||||
[self] {*}$args
|
||||
}
|
||||
} else {
|
||||
method execute args {
|
||||
return \
|
||||
[uplevel 1 \
|
||||
[list \
|
||||
[self] resultSetCreate \
|
||||
[namespace current]::ResultSet::[incr resultSetSeq] \
|
||||
[self] {*}$args]]
|
||||
}
|
||||
}
|
||||
|
||||
# The 'ResultSetCreate' method is expected to be a forward to the
|
||||
# appropriate result set constructor. If it's missing, the driver must
|
||||
# have been designed for tdbc 1.0b9 and earlier, and the 'resultSetClass'
|
||||
# variable holds the class name.
|
||||
|
||||
method resultSetCreate {name instance args} {
|
||||
return [uplevel 1 [list $resultSetClass create \
|
||||
$name $instance {*}$args]]
|
||||
}
|
||||
|
||||
# The 'resultsets' method returns a list of result sets produced by
|
||||
# the current statement
|
||||
|
||||
method resultsets {} {
|
||||
info commands ResultSet::*
|
||||
}
|
||||
|
||||
# The 'allrows' method executes a statement with a given set of
|
||||
# substituents, and returns a list of all the rows that the statement
|
||||
# returns. Optionally, it stores the names of columns in
|
||||
# '-columnsvariable'.
|
||||
#
|
||||
# Usage:
|
||||
# $statement allrows ?-as lists|dicts? ?-columnsvariable varName? ?--?
|
||||
# ?dictionary?
|
||||
|
||||
|
||||
method allrows args {
|
||||
|
||||
variable ::tdbc::generalError
|
||||
|
||||
# Grab keyword-value parameters
|
||||
|
||||
set args [::tdbc::ParseConvenienceArgs $args[set args {}] opts]
|
||||
|
||||
# Check postitional parameters
|
||||
|
||||
set cmd [list [self] execute]
|
||||
if {[llength $args] == 0} {
|
||||
# do nothing
|
||||
} elseif {[llength $args] == 1} {
|
||||
lappend cmd [lindex $args 0]
|
||||
} else {
|
||||
set errorcode $generalError
|
||||
lappend errorcode wrongNumArgs
|
||||
return -code error -errorcode $errorcode \
|
||||
"wrong # args: should be [lrange [info level 0] 0 1]\
|
||||
?-option value?... ?--? ?dictionary?"
|
||||
}
|
||||
|
||||
# Get the result set
|
||||
|
||||
set resultSet [uplevel 1 $cmd]
|
||||
|
||||
# Delegate to the result set's [allrows] method to accumulate
|
||||
# the rows of the result.
|
||||
|
||||
set cmd [list $resultSet allrows {*}$opts]
|
||||
set status [catch {
|
||||
uplevel 1 $cmd
|
||||
} result options]
|
||||
|
||||
# Destroy the result set
|
||||
|
||||
catch {
|
||||
rename $resultSet {}
|
||||
}
|
||||
|
||||
# Adjust return level in the case that the script [return]s
|
||||
|
||||
if {$status == 2} {
|
||||
set options [dict merge {-level 1} $options[set options {}]]
|
||||
dict incr options -level
|
||||
}
|
||||
return -options $options $result
|
||||
}
|
||||
|
||||
# The 'foreach' method executes a statement with a given set of
|
||||
# substituents. It runs the supplied script, substituting the supplied
|
||||
# named variable. Optionally, it stores the names of columns in
|
||||
# '-columnsvariable'.
|
||||
#
|
||||
# Usage:
|
||||
# $statement foreach ?-as lists|dicts? ?-columnsvariable varName? ?--?
|
||||
# variableName ?dictionary? script
|
||||
|
||||
method foreach args {
|
||||
|
||||
variable ::tdbc::generalError
|
||||
|
||||
# Grab keyword-value parameters
|
||||
|
||||
set args [::tdbc::ParseConvenienceArgs $args[set args {}] opts]
|
||||
|
||||
# Check positional parameters
|
||||
|
||||
set cmd [list [self] execute]
|
||||
if {[llength $args] == 2} {
|
||||
lassign $args varname script
|
||||
} elseif {[llength $args] == 3} {
|
||||
lassign $args varname dict script
|
||||
lappend cmd $dict
|
||||
} else {
|
||||
set errorcode $generalError
|
||||
lappend errorcode wrongNumArgs
|
||||
return -code error -errorcode $errorcode \
|
||||
"wrong # args: should be [lrange [info level 0] 0 1]\
|
||||
?-option value?... ?--? varName ?dictionary? script"
|
||||
}
|
||||
|
||||
# Get the result set
|
||||
|
||||
set resultSet [uplevel 1 $cmd]
|
||||
|
||||
# Delegate to the result set's [foreach] method to evaluate
|
||||
# the script for each row of the result.
|
||||
|
||||
set cmd [list $resultSet foreach {*}$opts -- $varname $script]
|
||||
set status [catch {
|
||||
uplevel 1 $cmd
|
||||
} result options]
|
||||
|
||||
# Destroy the result set
|
||||
|
||||
catch {
|
||||
rename $resultSet {}
|
||||
}
|
||||
|
||||
# Adjust return level in the case that the script [return]s
|
||||
|
||||
if {$status == 2} {
|
||||
set options [dict merge {-level 1} $options[set options {}]]
|
||||
dict incr options -level
|
||||
}
|
||||
return -options $options $result
|
||||
}
|
||||
|
||||
# The 'close' method is syntactic sugar for invoking the destructor
|
||||
|
||||
method close {} {
|
||||
my destroy
|
||||
}
|
||||
|
||||
# Derived classes are expected to implement their own constructors,
|
||||
# plus the following methods:
|
||||
|
||||
# paramtype paramName ?direction? type ?scale ?precision??
|
||||
# Declares the type of a parameter in the statement
|
||||
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Class: tdbc::resultset
|
||||
#
|
||||
# Class that represents a result set in a generic database.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
oo::class create tdbc::resultset {
|
||||
|
||||
constructor {} { }
|
||||
|
||||
# The 'allrows' method returns a list of all rows that a given
|
||||
# result set returns.
|
||||
|
||||
method allrows args {
|
||||
|
||||
variable ::tdbc::generalError
|
||||
|
||||
# Parse args
|
||||
|
||||
set args [::tdbc::ParseConvenienceArgs $args[set args {}] opts]
|
||||
if {[llength $args] != 0} {
|
||||
set errorcode $generalError
|
||||
lappend errorcode wrongNumArgs
|
||||
return -code error -errorcode $errorcode \
|
||||
"wrong # args: should be [lrange [info level 0] 0 1]\
|
||||
?-option value?... ?--? varName script"
|
||||
}
|
||||
|
||||
# Do -columnsvariable if requested
|
||||
|
||||
if {[dict exists $opts -columnsvariable]} {
|
||||
upvar 1 [dict get $opts -columnsvariable] columns
|
||||
}
|
||||
|
||||
# Assemble the results
|
||||
|
||||
if {[dict get $opts -as] eq {lists}} {
|
||||
set delegate nextlist
|
||||
} else {
|
||||
set delegate nextdict
|
||||
}
|
||||
set results [list]
|
||||
while {1} {
|
||||
set columns [my columns]
|
||||
while {[my $delegate row]} {
|
||||
lappend results $row
|
||||
}
|
||||
if {![my nextresults]} break
|
||||
}
|
||||
return $results
|
||||
|
||||
}
|
||||
|
||||
# The 'foreach' method runs a script on each row from a result set.
|
||||
|
||||
method foreach args {
|
||||
|
||||
variable ::tdbc::generalError
|
||||
|
||||
# Grab keyword-value parameters
|
||||
|
||||
set args [::tdbc::ParseConvenienceArgs $args[set args {}] opts]
|
||||
|
||||
# Check positional parameters
|
||||
|
||||
if {[llength $args] != 2} {
|
||||
set errorcode $generalError
|
||||
lappend errorcode wrongNumArgs
|
||||
return -code error -errorcode $errorcode \
|
||||
"wrong # args: should be [lrange [info level 0] 0 1]\
|
||||
?-option value?... ?--? varName script"
|
||||
}
|
||||
|
||||
# Do -columnsvariable if requested
|
||||
|
||||
if {[dict exists $opts -columnsvariable]} {
|
||||
upvar 1 [dict get $opts -columnsvariable] columns
|
||||
}
|
||||
|
||||
# Iterate over the groups of results
|
||||
while {1} {
|
||||
|
||||
# Export column names to caller
|
||||
|
||||
set columns [my columns]
|
||||
|
||||
# Iterate over the rows of one group of results
|
||||
|
||||
upvar 1 [lindex $args 0] row
|
||||
if {[dict get $opts -as] eq {lists}} {
|
||||
set delegate nextlist
|
||||
} else {
|
||||
set delegate nextdict
|
||||
}
|
||||
while {[my $delegate row]} {
|
||||
set status [catch {
|
||||
uplevel 1 [lindex $args 1]
|
||||
} result options]
|
||||
switch -exact -- $status {
|
||||
0 - 4 { # OK or CONTINUE
|
||||
}
|
||||
2 { # RETURN
|
||||
set options \
|
||||
[dict merge {-level 1} $options[set options {}]]
|
||||
dict incr options -level
|
||||
return -options $options $result
|
||||
}
|
||||
3 { # BREAK
|
||||
set broken 1
|
||||
break
|
||||
}
|
||||
default { # ERROR or unknown status
|
||||
return -options $options $result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Advance to the next group of results if there is one
|
||||
|
||||
if {[info exists broken] || ![my nextresults]} {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
# The 'nextrow' method retrieves a row in the form of either
|
||||
# a list or a dictionary.
|
||||
|
||||
method nextrow {args} {
|
||||
|
||||
variable ::tdbc::generalError
|
||||
|
||||
set opts [dict create -as dicts]
|
||||
set i 0
|
||||
|
||||
# Munch keyword options off the front of the command arguments
|
||||
|
||||
foreach {key value} $args {
|
||||
if {[string index $key 0] eq {-}} {
|
||||
switch -regexp -- $key {
|
||||
-as? {
|
||||
dict set opts -as $value
|
||||
}
|
||||
-- {
|
||||
incr i
|
||||
break
|
||||
}
|
||||
default {
|
||||
set errorcode $generalError
|
||||
lappend errorcode badOption $key
|
||||
return -code error -errorcode $errorcode \
|
||||
"bad option \"$key\":\
|
||||
must be -as or -columnsvariable"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break
|
||||
}
|
||||
incr i 2
|
||||
}
|
||||
|
||||
set args [lrange $args $i end]
|
||||
if {[llength $args] != 1} {
|
||||
set errorcode $generalError
|
||||
lappend errorcode wrongNumArgs
|
||||
return -code error -errorcode $errorcode \
|
||||
"wrong # args: should be [lrange [info level 0] 0 1]\
|
||||
?-option value?... ?--? varName"
|
||||
}
|
||||
upvar 1 [lindex $args 0] row
|
||||
if {[dict get $opts -as] eq {lists}} {
|
||||
set delegate nextlist
|
||||
} else {
|
||||
set delegate nextdict
|
||||
}
|
||||
return [my $delegate row]
|
||||
}
|
||||
|
||||
# Derived classes must override 'nextresults' if a single
|
||||
# statement execution can yield multiple sets of results
|
||||
|
||||
method nextresults {} {
|
||||
return 0
|
||||
}
|
||||
|
||||
# Derived classes must override 'outputparams' if statements can
|
||||
# have output parameters.
|
||||
|
||||
method outputparams {} {
|
||||
return {}
|
||||
}
|
||||
|
||||
# The 'close' method is syntactic sugar for destroying the result set.
|
||||
|
||||
method close {} {
|
||||
my destroy
|
||||
}
|
||||
|
||||
# Derived classes are expected to implement the following methods:
|
||||
|
||||
# constructor and destructor.
|
||||
# Constructor accepts a statement and an optional
|
||||
# a dictionary of substituted parameters and
|
||||
# executes the statement against the database. If
|
||||
# the dictionary is not supplied, then the default
|
||||
# is to get params from variables in the caller's scope).
|
||||
# columns
|
||||
# -- Returns a list of the names of the columns in the result.
|
||||
# nextdict variableName
|
||||
# -- Stores the next row of the result set in the given variable
|
||||
# in caller's scope, in the form of a dictionary that maps
|
||||
# column names to values.
|
||||
# nextlist variableName
|
||||
# -- Stores the next row of the result set in the given variable
|
||||
# in caller's scope, in the form of a list of cells.
|
||||
# rowcount
|
||||
# -- Returns a count of rows affected by the statement, or -1
|
||||
# if the count of rows has not been determined.
|
||||
|
||||
}
|
||||
BIN
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc115t.dll
vendored
Normal file
BIN
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc115t.dll
vendored
Normal file
Binary file not shown.
81
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbcConfig.sh
vendored
Normal file
81
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbcConfig.sh
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
# tdbcConfig.sh --
|
||||
#
|
||||
# This shell script (for sh) is generated automatically by TDBC's configure
|
||||
# script. It will create shell variables for most of the configuration options
|
||||
# discovered by the configure script. This script is intended to be included
|
||||
# by the configure scripts for TDBC extensions so that they don't have to
|
||||
# figure this all out for themselves.
|
||||
#
|
||||
# The information in this file is specific to a single platform.
|
||||
#
|
||||
# RCS: @(#) $Id$
|
||||
|
||||
# TDBC's version number
|
||||
tdbc_VERSION=1.1.5
|
||||
TDBC_VERSION=1.1.5
|
||||
|
||||
# Name of the TDBC library - may be either a static or shared library
|
||||
tdbc_LIB_FILE=tdbc115t.dll
|
||||
TDBC_LIB_FILE=tdbc115t.dll
|
||||
|
||||
# String to pass to the linker to pick up the TDBC library from its build dir
|
||||
tdbc_BUILD_LIB_SPEC="@tdbc_BUILD_LIB_SPEC@"
|
||||
TDBC_BUILD_LIB_SPEC="@tdbc_BUILD_LIB_SPEC@"
|
||||
|
||||
# String to pass to the linker to pick up the TDBC library from its installed
|
||||
# dir.
|
||||
tdbc_LIB_SPEC="C:/Users/naraw/Desktop/New folder/ImageUtils/.CondaPkg/env\Library\lib\tdbc1.1.5\tdbc115t.dll"
|
||||
TDBC_LIB_SPEC="C:/Users/naraw/Desktop/New folder/ImageUtils/.CondaPkg/env\Library\lib\tdbc1.1.5\tdbc115t.dll"
|
||||
|
||||
# Name of the TBDC stub library
|
||||
tdbc_STUB_LIB_FILE="tdbcstub115.lib"
|
||||
TDBC_STUB_LIB_FILE="tdbcstub115.lib"
|
||||
|
||||
# String to pass to the linker to pick up the TDBC stub library from its
|
||||
# build directory
|
||||
tdbc_BUILD_STUB_LIB_SPEC="D:\bld\tk_1695506172540\work\tcl8.6.13\pkgs\tdbc1.1.5\win\Release_AMD64_VC1929\tdbcstub115.lib"
|
||||
TDBC_BUILD_STUB_LIB_SPEC="D:\bld\tk_1695506172540\work\tcl8.6.13\pkgs\tdbc1.1.5\win\Release_AMD64_VC1929\tdbcstub115.lib"
|
||||
|
||||
# String to pass to the linker to pick up the TDBC stub library from its
|
||||
# installed directory
|
||||
tdbc_STUB_LIB_SPEC="C:/Users/naraw/Desktop/New folder/ImageUtils/.CondaPkg/env\Library\lib\tdbc1.1.5\tdbcstub115.lib"
|
||||
TDBC_STUB_LIB_SPEC="C:/Users/naraw/Desktop/New folder/ImageUtils/.CondaPkg/env\Library\lib\tdbc1.1.5\tdbcstub115.lib"
|
||||
|
||||
# Path name of the TDBC stub library in its build directory
|
||||
tdbc_BUILD_STUB_LIB_PATH="D:\bld\tk_1695506172540\work\tcl8.6.13\pkgs\tdbc1.1.5\win\Release_AMD64_VC1929\tdbcstub115.lib"
|
||||
TDBC_BUILD_STUB_LIB_PATH="D:\bld\tk_1695506172540\work\tcl8.6.13\pkgs\tdbc1.1.5\win\Release_AMD64_VC1929\tdbcstub115.lib"
|
||||
|
||||
# Path name of the TDBC stub library in its installed directory
|
||||
tdbc_STUB_LIB_PATH="C:/Users/naraw/Desktop/New folder/ImageUtils/.CondaPkg/env\Library\lib\tdbc1.1.5\tdbcstub115.lib"
|
||||
TDBC_STUB_LIB_PATH="C:/Users/naraw/Desktop/New folder/ImageUtils/.CondaPkg/env\Library\lib\tdbc1.1.5\tdbcstub115.lib"
|
||||
|
||||
# Location of the top-level source directories from which TDBC was built.
|
||||
# This is the directory that contains doc/, generic/ and so on. If TDBC
|
||||
# was compiled in a directory other than the source directory, this still
|
||||
# points to the location of the sources, not the location where TDBC was
|
||||
# compiled.
|
||||
tdbc_SRC_DIR="D:\bld\tk_1695506172540\work\tcl8.6.13\pkgs\tdbc1.1.5\win\.."
|
||||
TDBC_SRC_DIR="D:\bld\tk_1695506172540\work\tcl8.6.13\pkgs\tdbc1.1.5\win\.."
|
||||
|
||||
# String to pass to the compiler so that an extension can find installed TDBC
|
||||
# headers
|
||||
tdbc_INCLUDE_SPEC="-IC:/Users/naraw/Desktop/New folder/ImageUtils/.CondaPkg/env\Library\lib\..\include"
|
||||
TDBC_INCLUDE_SPEC="-IC:/Users/naraw/Desktop/New folder/ImageUtils/.CondaPkg/env\Library\lib\..\include"
|
||||
|
||||
# String to pass to the compiler so that an extension can find TDBC headers
|
||||
# in the source directory
|
||||
tdbc_BUILD_INCLUDE_SPEC="-ID:\bld\tk_1695506172540\work\tcl8.6.13\pkgs\tdbc1.1.5\win\..\generic"
|
||||
TDBC_BUILD_INCLUDE_SPEC="-ID:\bld\tk_1695506172540\work\tcl8.6.13\pkgs\tdbc1.1.5\win\..\generic"
|
||||
|
||||
# Path name where .tcl files in the tdbc package appear at run time.
|
||||
tdbc_LIBRARY_PATH="C:/Users/naraw/Desktop/New folder/ImageUtils/.CondaPkg/env\Library\lib\tdbc1.1.5"
|
||||
TDBC_LIBRARY_PATH="C:/Users/naraw/Desktop/New folder/ImageUtils/.CondaPkg/env\Library\lib\tdbc1.1.5"
|
||||
|
||||
# Path name where .tcl files in the tdbc package appear at build time.
|
||||
tdbc_BUILD_LIBRARY_PATH="D:\bld\tk_1695506172540\work\tcl8.6.13\pkgs\tdbc1.1.5\win\../library"
|
||||
TDBC_BUILD_LIBRARY_PATH="D:\bld\tk_1695506172540\work\tcl8.6.13\pkgs\tdbc1.1.5\win\../library"
|
||||
|
||||
# Additional flags that must be passed to the C compiler to use tdbc
|
||||
tdbc_CFLAGS=
|
||||
TDBC_CFLAGS=
|
||||
|
||||
376
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc_connection.n
vendored
Normal file
376
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc_connection.n
vendored
Normal file
@@ -0,0 +1,376 @@
|
||||
'\"
|
||||
'\" tdbc::connection.n --
|
||||
'\"
|
||||
'\" Copyright (c) 2008 by Kevin B. Kenny.
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution of
|
||||
'\" this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
.TH "tdbc::connection" n 8.6 Tcl "Tcl Database Connectivity"
|
||||
'\" .so man.macros
|
||||
'\" IGNORE
|
||||
.if t .wh -1.3i ^B
|
||||
.nr ^l \n(.l
|
||||
.ad b
|
||||
'\" # BS - start boxed text
|
||||
'\" # ^y = starting y location
|
||||
'\" # ^b = 1
|
||||
.de BS
|
||||
.br
|
||||
.mk ^y
|
||||
.nr ^b 1u
|
||||
.if n .nf
|
||||
.if n .ti 0
|
||||
.if n \l'\\n(.lu\(ul'
|
||||
.if n .fi
|
||||
..
|
||||
'\" # BE - end boxed text (draw box now)
|
||||
.de BE
|
||||
.nf
|
||||
.ti 0
|
||||
.mk ^t
|
||||
.ie n \l'\\n(^lu\(ul'
|
||||
.el \{\
|
||||
'\" Draw four-sided box normally, but don't draw top of
|
||||
'\" box if the box started on an earlier page.
|
||||
.ie !\\n(^b-1 \{\
|
||||
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
|
||||
.\}
|
||||
.el \}\
|
||||
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
|
||||
.\}
|
||||
.\}
|
||||
.fi
|
||||
.br
|
||||
.nr ^b 0
|
||||
..
|
||||
'\" END IGNORE
|
||||
.BS
|
||||
.SH "NAME"
|
||||
tdbc::connection \- TDBC connection object
|
||||
.SH "SYNOPSIS"
|
||||
.nf
|
||||
package require \fBtdbc 1.0\fR
|
||||
package require \fBtdbc::\fIdriver version\fR
|
||||
|
||||
\fBtdbc::\fIdriver\fB::connection create \fIdb\fR ?\fI\-option value\fR...?
|
||||
|
||||
\fIdb \fBconfigure\fR ?\fI\-option value\fR...?
|
||||
\fIdb \fBclose\fR
|
||||
\fIdb \fBforeignkeys\fR ?\fI\-primary tableName\fR? ?\fI\-foreign tableName\fR?
|
||||
\fIdb \fBprepare\fR \fIsql-code\fR
|
||||
\fIdb \fBpreparecall\fR \fIcall\fR
|
||||
\fIdb \fBprimarykeys\fR \fItableName\fR
|
||||
\fIdb \fBstatements\fR
|
||||
\fIdb \fBresultsets\fR
|
||||
\fIdb \fBtables\fR ?\fIpattern\fR?
|
||||
\fIdb \fBcolumns\fR \fItable\fR ?\fIpattern\fR?
|
||||
\fIdb \fBbegintransaction\fR
|
||||
\fIdb \fBcommit\fR
|
||||
\fIdb \fBrollback\fR
|
||||
\fIdb \fBtransaction\fR \fIscript\fR
|
||||
.fi
|
||||
.ad l
|
||||
.in 14
|
||||
.ti 7
|
||||
\fIdb \fBallrows\fR ?\fB\-as lists\fR|\fBdicts\fR? ?\fB\-columnsvariable \fIname\fR? ?\fB\-\-\fR? \fIsql-code\fR ?\fIdictionary\fR?
|
||||
.br
|
||||
.ti 7
|
||||
\fIdb \fBforeach\fR ?\fB\-as lists\fR|\fBdicts\fR? ?\fB\-columnsvariable \fIname\fR? ?\-\-? \fIvarName sqlcode\fR ?\fIdictionary\fR? \fIscript\fR
|
||||
.ad b
|
||||
.BE
|
||||
.SH "DESCRIPTION"
|
||||
.PP
|
||||
Every database driver for TDBC (Tcl DataBase Connectivity) implements
|
||||
a \fIconnection\fR object that represents a connection to a database.
|
||||
By convention, this object is created by the command,
|
||||
\fBtdbc::\fIdriver\fB::connection create\fR.
|
||||
This command accepts the name of a Tcl command that will represent the
|
||||
connection and a possible set of options (see \fBCONFIGURATION
|
||||
OPTIONS\fR). It establishes a connection to the database and returns
|
||||
the name of the newly-created Tcl command.
|
||||
.PP
|
||||
The \fBconfigure\fR object command on a database connection, if
|
||||
presented with no arguments, returns a list of alternating keywords
|
||||
and values representing the connection's current configuration. If
|
||||
presented with a single argument \fI\-option\fR, it returns the
|
||||
configured value of the given option. Otherwise, it must be given an
|
||||
even number of arguments which are alternating options and values. The
|
||||
specified options receive the specified values, and nothing is
|
||||
returned.
|
||||
.PP
|
||||
The \fBclose\fR object command on a database connection closes the
|
||||
connection. All active statements and result sets on the connection
|
||||
are closed. Any uncommitted transaction is rolled back. The object
|
||||
command is deleted.
|
||||
.PP
|
||||
The \fBprepare\fR object command on a database connection prepares a SQL
|
||||
statement for execution. The \fIsql-code\fR argument must contain a
|
||||
single SQL statement to be executed. Bound variables may be
|
||||
included. The return value is a
|
||||
newly-created Tcl command that represents the statement. See
|
||||
\fBtdbc::statement\fR for more detailed discussion of the
|
||||
SQL accepted by the \fBprepare\fR object command and the
|
||||
interface accepted by a statement.
|
||||
.PP
|
||||
On a database connection where the underlying database and driver
|
||||
support stored procedures, the \fBpreparecall\fR
|
||||
object command prepares a call to a stored procedure for execution.
|
||||
The syntax of the stored procedure call is:
|
||||
.PP
|
||||
.CS
|
||||
?\fIresultvar\fR =? \fIprocname\fR(?\fIarg\fR ?, \fIarg\fR...?)
|
||||
.CE
|
||||
.PP
|
||||
The return value is a
|
||||
newly-created Tcl command that represents the statement. See
|
||||
\fBtdbc::statement\fR for the interface accepted by a statement.
|
||||
.PP
|
||||
The \fBstatements\fR object command returns a list of statements
|
||||
that have been created by \fBprepare\fR and \fBpreparecall\fR
|
||||
statements against the given connection and have not yet been closed.
|
||||
.PP
|
||||
The \fBresultsets\fR object command returns a list of result sets
|
||||
that have been obtained by executing statements prepared using the
|
||||
given connection and not yet closed.
|
||||
.PP
|
||||
The \fBtables\fR object command allows the program to query the
|
||||
connection for the names of tables that exist in the database.
|
||||
The optional \fIpattern\fR parameter is a pattern to match the name of
|
||||
a table. It may contain the SQL wild-card characters '\fB%\fR' and
|
||||
'\fB_\fR'. The return value is a dictionary whose keys are table names
|
||||
and whose values are subdictionaries. See the documentation for the
|
||||
individual database driver for the interpretation of the values.
|
||||
.PP
|
||||
The \fBcolumns\fR object command allows the program to query the
|
||||
connection for the names of columns that exist in a given table.
|
||||
The optional \fBpattern\fR parameter is a pattern to match the name of
|
||||
a column. It may contain the SQL wild-card characters '\fB%\fR' and
|
||||
'\fB_\fR'. The return value is a dictionary whose keys are column names
|
||||
and whose values are dictionaries. Each of the subdictionaries will
|
||||
contain at least the following keys and values (and may contain others
|
||||
whose usage is determined by a specific database driver).
|
||||
.IP \fBtype\fR
|
||||
Contains the data type of the column, and will generally be chosen
|
||||
from the set,
|
||||
\fBbigint\fR, \fBbinary\fR, \fBbit\fR, \fBchar\fR, \fBdate\fR,
|
||||
\fBdecimal\fR, \fBdouble\fR, \fBfloat\fR, \fBinteger\fR,
|
||||
\fBlongvarbinary\fR, \fBlongvarchar\fR, \fBnumeric\fR, \fBreal\fR,
|
||||
\fBtime\fR, \fBtimestamp\fR, \fBsmallint\fR, \fBtinyint\fR,
|
||||
\fBvarbinary\fR, and \fBvarchar\fR. (If the column has a type that
|
||||
cannot be represented as one of the above, \fBtype\fR will contain
|
||||
a driver-dependent description of the type.)
|
||||
.IP \fBprecision\fR
|
||||
Contains the precision of the column in bits, decimal digits, or the
|
||||
width in characters, according to the type.
|
||||
.IP \fBscale\fR
|
||||
Contains the scale of the column (the number of digits after the radix
|
||||
point), for types that support the concept.
|
||||
.IP \fBnullable\fR
|
||||
Contains 1 if the column can contain NULL values, and 0 otherwise.
|
||||
.PP
|
||||
The \fBprimarykeys\fR object command allows the program to query the
|
||||
connection for the primary keys belonging to a given table. The
|
||||
\fItableName\fR parameter identifies the table being interrogated. The result
|
||||
is a list of dictionaries enumerating the keys (in a similar format to the
|
||||
list returned by \fI$connection\fR \fBallrows -as dicts\fR). The keys of the
|
||||
dictionary may include at least the following. Values that are NULL or
|
||||
meaningless in a given database are omitted.
|
||||
.IP \fBtableCatalog\fR
|
||||
Name of the catalog in which the table appears.
|
||||
.IP \fBtableSchema\fR
|
||||
Name of the schema in which the table appears.
|
||||
.IP \fBtableName\fR
|
||||
Name of the table owning the primary key.
|
||||
.IP \fBconstraintCatalog\fR
|
||||
Name of the catalog in which the primary key constraint appears. In some
|
||||
database systems, this may not be the same as the table's catalog.
|
||||
.IP \fBconstraintSchema\fR
|
||||
Name of the schema in which the primary key constraint appears. In some
|
||||
database systems, this may not be the same as the table's schema.
|
||||
.IP \fBconstraintName\fR
|
||||
Name of the primary key constraint,
|
||||
.IP \fBcolumnName\fR
|
||||
Name of a column that is a member of the primary key.
|
||||
.IP \fBordinalPosition\fR
|
||||
Ordinal position of the column within the primary key.
|
||||
.PP
|
||||
To these columns may be added additional ones that are specific to
|
||||
a particular database system.
|
||||
.PP
|
||||
The \fBforeignkeys\fR object command allows the program to query the
|
||||
connection for foreign key relationships that apply to a particular table.
|
||||
The relationships may be constrained to the keys that appear in a
|
||||
particular table (\fB-foreign\fR \fItableName\fR), the keys that
|
||||
refer to a particular table (\fB-primary\fR \fItableName\fR), or both.
|
||||
At least one of \fB-primary\fR and \fB-foreign\fR should be specified,
|
||||
although some drivers will enumerate all foreign keys in the current
|
||||
catalog if both options are omitted. The result of the \fBforeignkeys\fR
|
||||
object command is a list of dictionaries, with one list element per key
|
||||
(in a similar format to the
|
||||
list returned by \fI$connection\fR \fBallrows -as dicts\fR). The keys of the
|
||||
dictionary may include at least the following. Values that are NULL or
|
||||
meaningless in a given database are omitted.
|
||||
.IP \fBforeignConstraintCatalog\fR
|
||||
Catalog in which the foreign key constraint appears.
|
||||
.IP \fBforeignConstraintSchema\fR
|
||||
Schema in which the foreign key constraint appears.
|
||||
.IP \fBforeignConstraintName\fR
|
||||
Name of the foreign key constraint.
|
||||
.IP \fBprimaryConstraintCatalog\fR
|
||||
Catalog holding the primary key constraint (or unique key constraint) on the
|
||||
column to which the foreign key refers.
|
||||
.IP \fBprimaryConstraintSchema\fR
|
||||
Schema holding the primary key constraint (or unique key constraint) on the
|
||||
column to which the foreign key refers.
|
||||
.IP \fBprimaryConstraintName\fR
|
||||
Name of the primary key constraint (or unique key constraint) on the
|
||||
column to which the foreign key refers.
|
||||
.IP \fBupdateAction\fR
|
||||
Action to take when an UPDATE statement invalidates the constraint.
|
||||
The value will be \fBCASCADE\fR, \fBSET DEFAULT\fR, \fBSET NULL\fR,
|
||||
\fBRESTRICT\fR, or \fBNO ACTION\fR.
|
||||
.IP \fBdeleteAction\fR
|
||||
Action to take when a DELETE statement invalidates the constraint.
|
||||
The value will be \fBCASCADE\fR, \fBSET DEFAULT\fR, \fBSET NULL\fR,
|
||||
\fBRESTRICT\fR, or \fBNO ACTION\fR.
|
||||
.IP \fBprimaryCatalog\fR
|
||||
Catalog name in which the primary table (the one to which the foreign key
|
||||
refers) appears.
|
||||
.IP \fBprimarySchema\fR
|
||||
Schema name in which the primary table (the one to which the foreign key
|
||||
refers) appears.
|
||||
.PP
|
||||
.IP \fBprimaryTable\fR
|
||||
Table name of the primary table (the one to which the foreign key
|
||||
refers).
|
||||
.IP \fBprimaryColumn\fR
|
||||
Name of the column to which the foreign key refers.
|
||||
.IP \fBforeignCatalog\fR
|
||||
Name of the catalog in which the table containing the foreign key appears.
|
||||
.IP \fBforeignSchema\fR
|
||||
Name of the schema in which the table containing the foreign key appears.
|
||||
.IP \fBforeignTable\fR
|
||||
Name of the table containing the foreign key.
|
||||
.IP \fBforeignColumn\fR
|
||||
Name of the column appearing in the foreign key.
|
||||
.IP \fBordinalPosition\fR
|
||||
Position of the column in the foreign key, if the key is a compound key.
|
||||
.PP
|
||||
The \fBbegintransaction\fR object command on a database connection
|
||||
begins a transaction on the database. If the underlying database does
|
||||
not support atomic, consistent, isolated, durable transactions, the
|
||||
\fBbegintransaction\fR object command returns an error reporting the
|
||||
fact. Similarly, if multiple \fBbegintransaction\fR commands are executed
|
||||
withough an intervening \fBcommit\fR or \fBrollback\fR command, an
|
||||
error is returned unless the underlying database supports nested
|
||||
transactions.
|
||||
.PP
|
||||
The \fBcommit\fR object command on a database connection ends the most
|
||||
recent transaction started by \fBbegintransaction\fR and commits
|
||||
changes to the database.
|
||||
.PP
|
||||
The \fBrollback\fR object command on a database connection rolls back
|
||||
the most recent transaction started by \fBbegintransaction\fR. The
|
||||
state of the database is as if nothing happened during the
|
||||
transaction.
|
||||
.PP
|
||||
The \fBtransaction\fR object command on a database connection
|
||||
presents a simple way of bundling a database transaction. It begins a
|
||||
transaction, and evaluates the supplied \fIscript\fR argument as a Tcl
|
||||
script in the caller's scope. If \fIscript\fR terminates normally, or
|
||||
by \fBbreak\fR, \fBcontinue\fR, or \fBreturn\fR, the transaction is
|
||||
committed (and any action requested by \fBbreak\fR, \fBcontinue\fR, or
|
||||
\fBreturn\fR takes place). If the commit fails for any reason,
|
||||
the error in the commit is treated as an error in the \fIscript\fR.
|
||||
In the case of an error in \fIscript\fR or in the commit,
|
||||
the transaction is rolled back and the error is
|
||||
rethrown. Any nonstandard return code from the script
|
||||
causes the transaction to be rolled back and then is rethrown.
|
||||
.PP
|
||||
The \fBallrows\fR object command prepares a SQL statement (given by
|
||||
the \fIsql-code\fR parameter) to execute against the database.
|
||||
It then executes it (see \fBtdbc::statement\fR for details) with the
|
||||
optional \fIdictionary\fR parameter giving bind variables. Finally,
|
||||
it uses the \fIallrows\fR object command on the result set (see
|
||||
\fBtdbc::resultset\fR) to construct a list of the results. Finally, both
|
||||
result set and statement are closed. The return value is the list of
|
||||
results.
|
||||
.PP
|
||||
The \fBforeach\fR object command prepares a SQL statement (given by
|
||||
the \fIsql-code\fR parameter) to execute against the database.
|
||||
It then executes it (see \fBtdbc::statement\fR for details) with the
|
||||
optional \fIdictionary\fR parameter giving bind variables. Finally,
|
||||
it uses the \fIforeach\fR object command on the result set (see
|
||||
\fBtdbc::resultset\fR) to evaluate the given \fIscript\fR for each row of
|
||||
the results. Finally, both result set and statement are closed, even
|
||||
if the given \fIscript\fR results in a \fBreturn\fR, an error, or
|
||||
an unusual return code.
|
||||
.SH "CONFIGURATION OPTIONS"
|
||||
The configuration options accepted when the connection is created and
|
||||
on the connection's \fBconfigure\fR object command include the
|
||||
following, and may include others specific to a database driver.
|
||||
.IP "\fB\-encoding \fIname\fR"
|
||||
Specifies the encoding to be used in connecting to the database.
|
||||
The \fIname\fR should be one of the names accepted by the
|
||||
\fBencoding\fR command. This option is usually unnecessary; most
|
||||
database drivers can figure out the encoding in use by themselves.
|
||||
.IP "\fB\-isolation \fIlevel\fR"
|
||||
Specifies the transaction isolation level needed for transactions on
|
||||
the database. The acceptable values for \fIlevel\fR are shown under
|
||||
\fBTRANSACTION ISOLATION LEVELS\fR.
|
||||
.IP "\fB\-timeout \fIms\fR"
|
||||
Specifies the maximum time to wait for a an operation database engine before
|
||||
reporting an error to the caller. The \fIms\fR argument gives the
|
||||
maximum time in milliseconds. A value of zero (the default) specifies
|
||||
that the calling process is to wait indefinitely for database
|
||||
operations.
|
||||
.IP "\fB\-readonly \fIflag\fR"
|
||||
Specifies that the connection will not modify the database (if the
|
||||
Boolean parameter \fIflag\fR is true), or that it may modify the
|
||||
database (if \fIflag\fR is false). If \fIflag\fR is true, this option
|
||||
may have the effect of raising the transaction isolation level to
|
||||
\fIreadonly\fR.
|
||||
.SS "TRANSACTION ISOLATION LEVELS"
|
||||
The acceptable values for the \fB\-isolation\fR configuration option
|
||||
are as follows:
|
||||
.IP \fBreaduncommitted\fR
|
||||
Allows the transaction to read "dirty", that is, uncommitted
|
||||
data. This isolation level may compromise data integrity, does not
|
||||
guarantee that foreign keys or uniqueness constraints are satisfied,
|
||||
and in general does not guarantee data consistency.
|
||||
.IP \fBreadcommitted\fR
|
||||
Forbids the transaction from reading "dirty" data, but does not
|
||||
guarantee repeatable reads; if a transaction reads a row of a database
|
||||
at a given time, there is no guarantee that the same row will be
|
||||
available at a later time in the same transaction.
|
||||
.IP \fBrepeatableread\fR
|
||||
Guarantees that any row of the database, once read, will have the same
|
||||
values for the life of a transaction. Still permits "phantom reads"
|
||||
(that is, newly-added rows appearing if a table is queried a second
|
||||
time).
|
||||
.IP \fBserializable\fR
|
||||
The most restrictive (and most expensive) level of transaction isolation. Any query to the database, if repeated, will return precisely the same results for the life of the transaction, exactly as if the transaction is the only user of the database.
|
||||
.IP \fBreadonly\fR
|
||||
Behaves like \fBserializable\fR in that the only results visible to
|
||||
the transaction are those that were committed prior to the start of
|
||||
the transaction, but forbids the transaction from modifying the
|
||||
database.
|
||||
.PP
|
||||
A database that does not implement one of these isolation levels
|
||||
will instead use the next more restrictive isolation level. If the
|
||||
given level of isolation cannot be obtained, the database interface
|
||||
throws an error reporting the fact. The default isolation level
|
||||
is \fBreadcommitted\fR.
|
||||
.PP
|
||||
A script should not the isolation level when a transaction is in
|
||||
progress.
|
||||
.SH "SEE ALSO"
|
||||
encoding(n), tdbc(n), tdbc::resultset(n), tdbc::statement(n), tdbc::tokenize(n)
|
||||
.SH "KEYWORDS"
|
||||
TDBC, SQL, database, connectivity, connection, resultset, statement
|
||||
.SH "COPYRIGHT"
|
||||
Copyright (c) 2008 by Kevin B. Kenny.
|
||||
'\" Local Variables:
|
||||
'\" mode: nroff
|
||||
'\" End:
|
||||
'\"
|
||||
93
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc_mapSqlState.n
vendored
Normal file
93
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc_mapSqlState.n
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
'\"
|
||||
'\" tdbc_mapSqlState.n --
|
||||
'\"
|
||||
'\" Copyright (c) 2009 by Kevin B. Kenny.
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution of
|
||||
'\" this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH "tdbc::mapSqlState" n 8.6 Tcl "Tcl Database Connectivity"
|
||||
'\" .so man.macros
|
||||
'\" IGNORE
|
||||
.if t .wh -1.3i ^B
|
||||
.nr ^l \n(.l
|
||||
.ad b
|
||||
'\" # BS - start boxed text
|
||||
'\" # ^y = starting y location
|
||||
'\" # ^b = 1
|
||||
.de BS
|
||||
.br
|
||||
.mk ^y
|
||||
.nr ^b 1u
|
||||
.if n .nf
|
||||
.if n .ti 0
|
||||
.if n \l'\\n(.lu\(ul'
|
||||
.if n .fi
|
||||
..
|
||||
'\" # BE - end boxed text (draw box now)
|
||||
.de BE
|
||||
.nf
|
||||
.ti 0
|
||||
.mk ^t
|
||||
.ie n \l'\\n(^lu\(ul'
|
||||
.el \{\
|
||||
'\" Draw four-sided box normally, but don't draw top of
|
||||
'\" box if the box started on an earlier page.
|
||||
.ie !\\n(^b-1 \{\
|
||||
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
|
||||
.\}
|
||||
.el \}\
|
||||
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
|
||||
.\}
|
||||
.\}
|
||||
.fi
|
||||
.br
|
||||
.nr ^b 0
|
||||
..
|
||||
'\" # CS - begin code excerpt
|
||||
.de CS
|
||||
.RS
|
||||
.nf
|
||||
.ta .25i .5i .75i 1i
|
||||
..
|
||||
'\" # CE - end code excerpt
|
||||
.de CE
|
||||
.fi
|
||||
.RE
|
||||
..
|
||||
'\" END IGNORE
|
||||
.BS
|
||||
.SH "NAME"
|
||||
tdbc::mapSqlState \- Map SQLSTATE to error class
|
||||
.SH "SYNOPSIS"
|
||||
.nf
|
||||
package require \fBtdbc 1.0\fR
|
||||
|
||||
\fBtdbc::mapSqlState\fR \fIsqlstate\fR
|
||||
.fi
|
||||
.BE
|
||||
.SH "DESCRIPTION"
|
||||
.PP
|
||||
The \fBtdbc::mapSqlState\fR command accepts a string that is expected
|
||||
to be a five-character 'SQL state' as returned from a SQL database when
|
||||
an error occurs. It examines the first two characters of the string,
|
||||
and returns an error class as a human- and machine-readable name (for example,
|
||||
\fBFEATURE_NOT_SUPPORTED\fR, \fBDATA_EXCEPTION\fR or
|
||||
\fBINVALID_CURSOR_STATE\fR).
|
||||
.PP
|
||||
The TDBC specification requires database drivers to return a description
|
||||
of an error in the error code when an error occurs. The description is
|
||||
a string that has at least four elements: "\fBTDBC\fR \fIerrorClass\fR
|
||||
\fIsqlstate\fR \fIdriverName\fR \fIdetails...\fR". The \fBtdbc::mapSqlState\fR
|
||||
command gives a convenient way for a TDBC driver to generate the
|
||||
\fIerrorClass\fR element given the SQL state returned from a database.
|
||||
.SH "SEE ALSO"
|
||||
tdbc(n), tdbc::tokenize, tdbc::connection(n), tdbc::statement(n), tdbc::resultset(n)
|
||||
.SH "KEYWORDS"
|
||||
TDBC, SQL, database, state
|
||||
.SH "COPYRIGHT"
|
||||
Copyright (c) 2009 by Kevin B. Kenny.
|
||||
'\" Local Variables:
|
||||
'\" mode: nroff
|
||||
'\" End:
|
||||
'\"
|
||||
191
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc_resultset.n
vendored
Normal file
191
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc_resultset.n
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
'\"
|
||||
'\" tdbc_resultset.n --
|
||||
'\"
|
||||
'\" Copyright (c) 2008 by Kevin B. Kenny.
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution of
|
||||
'\" this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH "tdbc::resultset" n 8.6 Tcl "Tcl Database Connectivity"
|
||||
'\" .so man.macros
|
||||
'\" IGNORE
|
||||
.if t .wh -1.3i ^B
|
||||
.nr ^l \n(.l
|
||||
.ad b
|
||||
'\" # BS - start boxed text
|
||||
'\" # ^y = starting y location
|
||||
'\" # ^b = 1
|
||||
.de BS
|
||||
.br
|
||||
.mk ^y
|
||||
.nr ^b 1u
|
||||
.if n .nf
|
||||
.if n .ti 0
|
||||
.if n \l'\\n(.lu\(ul'
|
||||
.if n .fi
|
||||
..
|
||||
'\" # BE - end boxed text (draw box now)
|
||||
.de BE
|
||||
.nf
|
||||
.ti 0
|
||||
.mk ^t
|
||||
.ie n \l'\\n(^lu\(ul'
|
||||
.el \{\
|
||||
'\" Draw four-sided box normally, but don't draw top of
|
||||
'\" box if the box started on an earlier page.
|
||||
.ie !\\n(^b-1 \{\
|
||||
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
|
||||
.\}
|
||||
.el \}\
|
||||
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
|
||||
.\}
|
||||
.\}
|
||||
.fi
|
||||
.br
|
||||
.nr ^b 0
|
||||
..
|
||||
'\" # CS - begin code excerpt
|
||||
.de CS
|
||||
.RS
|
||||
.nf
|
||||
.ta .25i .5i .75i 1i
|
||||
..
|
||||
'\" # CE - end code excerpt
|
||||
.de CE
|
||||
.fi
|
||||
.RE
|
||||
..
|
||||
'\" END IGNORE
|
||||
.BS
|
||||
.SH "NAME"
|
||||
tdbc::resultset \- TDBC result set object
|
||||
.SH "SYNOPSIS"
|
||||
.nf
|
||||
package require \fBtdbc 1.0\fR
|
||||
package require \fBtdbc::\fR\fIdriver version\fR
|
||||
|
||||
\fBtdbc::\fR\fIdriver\fR\fB::connection create \fR\fIdb\fR \fI?\-option value\fR...?
|
||||
|
||||
\fBset\fR \fIstmt\fR \fB[\fR\fIdb\fR \fBprepare\fR \fIsql-code\fR\fB]\fR
|
||||
\fBset\fR \fIresultset\fR \fB[\fR\fI$stmt\fR \fBexecute\fR ?\fIargs...\fR?\fB]\fR
|
||||
|
||||
\fI$resultset\fR \fBcolumns\fR
|
||||
\fI$resultset\fR \fBrowcount\fR
|
||||
\fI$resultset\fR \fBnextrow\fR ?\fB-as\fR \fBlists\fR|\fBdicts\fR? ?\fB--\fR? \fIvarname\fR
|
||||
\fI$resultset\fR \fBnextlist\fR \fIvarname\fR
|
||||
\fI$resultset\fR \fBnextdict\fR \fIvarname\fR
|
||||
\fI$resultset\fR \fBnextresults\fR
|
||||
.fi
|
||||
.ad l
|
||||
.in 14
|
||||
.ti 7
|
||||
\fI$resultset\fR \fBallrows\fR ?\fB-as lists|dicts\fR? ?\fB-columnsvariable\fR \fIname\fR? ?\fB--\fR?
|
||||
.br
|
||||
.ti 7
|
||||
\fI$resultset\fR \fBforeach\fR ?\fB-as lists|dicts\fR? ?\fB-columnsvariable\fR \fIname\fR? ?\fB--\fR? \fIvarname\fR \fIscript\fR
|
||||
.br
|
||||
.ti 7
|
||||
\fI$resultset\fR \fBclose\fR
|
||||
.ad b
|
||||
.BE
|
||||
.SH "DESCRIPTION"
|
||||
.PP
|
||||
Every database driver for TDBC (Tcl DataBase Connectivity) implements
|
||||
a \fIresult set\fR object that represents a the results returned from
|
||||
executing SQL statement in a database. Instances of this object are created
|
||||
by executing the \fBexecute\fR object command on a statement object.
|
||||
.PP
|
||||
The \fBcolumns\fR object command returns a list of the names of the columns
|
||||
in the result set. The columns will appear in the same order as they appeared
|
||||
in the SQL statement that performed the database query. If the SQL statement
|
||||
does not return a set of columns (for instance, if it is an INSERT,
|
||||
UPDATE, or DELETE statement), the \fBcolumns\fR command will return an empty
|
||||
list.
|
||||
.PP
|
||||
The \fBrowcount\fR object command returns the number of rows in the database
|
||||
that were affected by the execution of an INSERT, UPDATE or DELETE statement.
|
||||
For a SELECT statement, the row count is unspecified.
|
||||
.PP
|
||||
The \fBnextlist\fR object command sets the variable given by \fIvarname\fR
|
||||
in the caller's scope to the next row of the results, expressed as a list
|
||||
of column values. NULL values are replaced by empty strings. The
|
||||
columns of the result row appear in the same order in which they
|
||||
appeared on the SELECT statement. The
|
||||
return of \fBnextlist\fR is \fB1\fR if the operation succeeded, and
|
||||
\fB0\fR if the end of the result set was reached.
|
||||
.PP
|
||||
The \fBnextdict\fR object command sets the variable given by \fIvarname\fR
|
||||
in the caller's scope to the next row of the results, expressed as a
|
||||
dictionary. The dictionary's keys are column names, and the values are
|
||||
the values of those columns in the row. If a column's value in the row
|
||||
is NULL, its key is omitted from the dictionary.
|
||||
The keys appear in the dictionary in the same order in which the
|
||||
columns appeared on the SELECT statement. The
|
||||
return of \fBnextdict\fR is \fB1\fR if the operation succeeded, and
|
||||
\fB0\fR if the end of the result set was reached.
|
||||
.PP
|
||||
The \fBnextrow\fR object command is precisely equivalent to the
|
||||
\fBnextdict\fR or \fBnextlist\fR object command, depending on whether
|
||||
\fB-as dicts\fR (the default) or \fB-as lists\fR is specified.
|
||||
.PP
|
||||
Some databases support the idea of a single statement that returns multiple
|
||||
sets of results. The \fBnextresults\fR object command is executed, typically
|
||||
after the \fBnextlist\fR of \fBnextdict\fR object command has returned
|
||||
\fB0\fR, to advance to the next result set. It returns \fB1\fR if there
|
||||
is another result set to process, and \fB0\fR if the result set just
|
||||
processed was the last. After calling \fBnextresults\fR and getting
|
||||
the return value of \fB1\fR, the caller may once again call \fBcolumns\fR
|
||||
to get the column descriptions of the next result set, and then return to
|
||||
calling \fBnextdict\fR or \fBnextlist\fR to process the rows of the
|
||||
next result set. It is an error to call \fBcolumns\fR, \fBnextdict\fR,
|
||||
\fBnextlist\fR or \fBnextrow\fR after \fBnextresults\fR has returned \fB0\fR.
|
||||
.PP
|
||||
The \fBallrows\fR object command sets the variable designated by the
|
||||
\fB-columnsvariable\fR option (if present) to the result of the \fBcolumns\fR
|
||||
object command. It then executes the \fBnextrow\fR object command
|
||||
repeatedly until the end of the result set is reached. If \fBnextresults\fR
|
||||
returns a nonzero value, it executes the above two steps (\fBcolumns\fR
|
||||
followed by iterated \fBnextrow\fR calls) as long as further results are
|
||||
available. The rows returned by \fBnextrow\fR
|
||||
are assembled into a Tcl list and become the return value of the
|
||||
\fBallrows\fR command; the last value returned from \fBcolumns\fR is what
|
||||
the application will see in \fB-columnsvariable\fR.
|
||||
.PP
|
||||
The \fBforeach\fR object command sets the variable designated by the
|
||||
\fB-columnsvariable\fR option (if present) to the result of the \fBcolumns\fR
|
||||
object command. It then executes the \fBnextrow\fR object command
|
||||
repeatedly until the end of the result set is reached, storing the
|
||||
successive rows in the variable designated by \fIvarName\fR. For each
|
||||
row, it executes the given \fIscript\fR. If the script terminates with
|
||||
an error, the error is reported by the \fBforeach\fR command, and
|
||||
iteration stops. If the script performs a \fBbreak\fR operation, the
|
||||
iteration terminates prematurely. If the script performs a
|
||||
\fBcontinue\fR operation, the iteration recommences with the next row.
|
||||
If the script performs a \fBreturn\fR, results are the same as if a
|
||||
script outside the control of \fBforeach\fR had returned. Any other
|
||||
unusual return code terminates the iteration and is reported from the
|
||||
\fBforeach\fR.
|
||||
.PP
|
||||
Once \fBnextrow\fR returns \fB0\fR, the \fBforeach\fR object command
|
||||
tries to advance to the next result set using \fBnextresults\fR. If
|
||||
\fBnextresults\fR returns \fB1\fR, the above steps (\fBcolumns\fR and
|
||||
\fBnextrow\fR, with script invocation) are repeated as long as more
|
||||
result sets remain. The \fIscript\fR will always see the correct description
|
||||
of the columns of the current result set in the variable designated
|
||||
byt \fB-columnsvariable\fR. At the end of the call, the variable
|
||||
designated by \fB-columnsvariable\fR will have the description of the
|
||||
columns of the last result set.
|
||||
.PP
|
||||
The \fBclose\fR object command deletes the result set and frees any
|
||||
associated system resources.
|
||||
.SH "SEE ALSO"
|
||||
encoding(n), tdbc(n), tdbc::connection(n), tdbc::statement(n), tdbc::tokenize(n)
|
||||
.SH "KEYWORDS"
|
||||
TDBC, SQL, database, connectivity, connection, resultset, statement,
|
||||
bound variable, stored procedure, call
|
||||
.SH "COPYRIGHT"
|
||||
Copyright (c) 2008 by Kevin B. Kenny.
|
||||
'\" Local Variables:
|
||||
'\" mode: nroff
|
||||
'\" End:
|
||||
'\"
|
||||
236
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc_statement.n
vendored
Normal file
236
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc_statement.n
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
'\"
|
||||
'\" tdbc_statement.n --
|
||||
'\"
|
||||
'\" Copyright (c) 2008 by Kevin B. Kenny.
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution of
|
||||
'\" this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
.TH "tdbc::statement" n 8.6 Tcl "Tcl Database Connectivity"
|
||||
'\" .so man.macros
|
||||
'\" IGNORE
|
||||
.if t .wh -1.3i ^B
|
||||
.nr ^l \n(.l
|
||||
.ad b
|
||||
'\" # BS - start boxed text
|
||||
'\" # ^y = starting y location
|
||||
'\" # ^b = 1
|
||||
.de BS
|
||||
.br
|
||||
.mk ^y
|
||||
.nr ^b 1u
|
||||
.if n .nf
|
||||
.if n .ti 0
|
||||
.if n \l'\\n(.lu\(ul'
|
||||
.if n .fi
|
||||
..
|
||||
'\" # BE - end boxed text (draw box now)
|
||||
.de BE
|
||||
.nf
|
||||
.ti 0
|
||||
.mk ^t
|
||||
.ie n \l'\\n(^lu\(ul'
|
||||
.el \{\
|
||||
'\" Draw four-sided box normally, but don't draw top of
|
||||
'\" box if the box started on an earlier page.
|
||||
.ie !\\n(^b-1 \{\
|
||||
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
|
||||
.\}
|
||||
.el \}\
|
||||
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
|
||||
.\}
|
||||
.\}
|
||||
.fi
|
||||
.br
|
||||
.nr ^b 0
|
||||
..
|
||||
'\" # CS - begin code excerpt
|
||||
.de CS
|
||||
.RS
|
||||
.nf
|
||||
.ta .25i .5i .75i 1i
|
||||
..
|
||||
'\" # CE - end code excerpt
|
||||
.de CE
|
||||
.fi
|
||||
.RE
|
||||
..
|
||||
'\" END IGNORE
|
||||
.BS
|
||||
.SH "NAME"
|
||||
tdbc::statement \- TDBC statement object
|
||||
.SH "SYNOPSIS"
|
||||
.nf
|
||||
package require \fBtdbc 1.0\fR
|
||||
package require \fBtdbc::\fR\fIdriver version\fR
|
||||
|
||||
\fBtdbc::\fR\fIdriver\fR\fB::connection create \fR\fIdb\fR \fI?\-option value\fR...?
|
||||
|
||||
\fBset\fR \fIstmt\fR \fB[\fR\fIdb\fR \fBprepare\fR \fIsql-code\fR\fB]\fR
|
||||
\fBset\fR \fIstmt\fR \fB[\fR\fIdb\fR \fBpreparecall\fR \fIcall\fR\fB]\fR
|
||||
|
||||
\fI$stmt\fR \fBparams\fR
|
||||
\fI$stmt\fR \fBparamtype\fR ?\fIdirection\fR? \fItype\fR ?\fIprecision\fR? ?\fIscale\fR?
|
||||
\fI$stmt\fR \fBexecute\fR ?\fIdict\fR?
|
||||
\fI$stmt\fR \fBresultsets\fR
|
||||
.fi
|
||||
.ad l
|
||||
.in 14
|
||||
.ti 7
|
||||
\fI$stmt\fR \fBallrows\fR ?\fB-as lists|dicts\fR? ?\fB-columnsvariable\fR \fIname\fR? ?\fB--\fR? ?\fIdict\fR
|
||||
.br
|
||||
.ti 7
|
||||
\fI$stmt\fR \fBforeach\fR ?\fB-as lists|dicts\fR? ?\fB-columnsvariable\fR \fIname\fR? ?\fB--\fR? \fIvarName\fR ?\fIdict\fR? \fIscript\fR
|
||||
.br
|
||||
.ti 7
|
||||
\fI$stmt\fR \fBclose\fR
|
||||
.ad b
|
||||
.BE
|
||||
.SH "DESCRIPTION"
|
||||
.PP
|
||||
Every database driver for TDBC (Tcl DataBase Connectivity) implements
|
||||
a \fIstatement\fR object that represents a SQL statement in a
|
||||
database. Instances of this object are created by executing the
|
||||
\fBprepare\fR or \fBpreparecall\fR object command on a database
|
||||
connection.
|
||||
.PP
|
||||
The \fBprepare\fR object command against the connection
|
||||
accepts arbitrary SQL code to be
|
||||
executed against the database. The SQL code may contain \fIbound
|
||||
variables\fR, which are strings of alphanumeric characters or
|
||||
underscores (the first character of the string may not be numeric),
|
||||
prefixed with a colon (\fB:\fR). If a bound variable appears in the
|
||||
SQL statement, and is not in a string set off by single or double
|
||||
quotes, nor in a comment introduced by \fB--\fR, it becomes a value
|
||||
that is substituted when the statement is executed. A bound variable
|
||||
becomes a single value (string or numeric) in the resulting
|
||||
statement. \fIDrivers are responsible for ensuring that the mechanism
|
||||
for binding variables prevents SQL injection.\fR
|
||||
.PP
|
||||
The \fBpreparecall\fR object command against the connection accepts a
|
||||
stylized statement in the form:
|
||||
.PP
|
||||
.CS
|
||||
\fIprocname\fR \fB(\fR?\fB:\fR\fIvarname\fR? ?\fB,:\fR\fIvarname\fR...?\fB)\fR
|
||||
.CE
|
||||
.PP
|
||||
or
|
||||
.PP
|
||||
.CS
|
||||
\fIvarname\fR \fB=\fR \fIprocname\fR \fB(\fR?\fB:\fR\fIvarname\fR? ?\fB,:\fR\fIvarname\fR...?\fB)\fR
|
||||
.CE
|
||||
.PP
|
||||
This statement represents a call to a stored procedure \fIprocname\fR in the
|
||||
database. The variable name to the left of the equal sign (if
|
||||
present), and all variable names that are parameters inside
|
||||
parentheses, become bound variables.
|
||||
.PP
|
||||
The \fBparams\fR method against a statement object enumerates the
|
||||
bound variables that appear in the statement. The result returned from
|
||||
the \fBparams\fR method is a dictionary whose keys are the names of
|
||||
bound variables (listed in the order in which the variables first
|
||||
appear in the statement), and whose values are dictionaries. The
|
||||
subdictionaries include at least the following keys (database drivers
|
||||
may add additional keys that are not in this list).
|
||||
.IP \fBdirection\fR
|
||||
Contains one of the keywords, \fBin\fR, \fBout\fR or \fBinout\fR
|
||||
according to whether the variable is an input to or output from the
|
||||
statement. Only stored procedure calls will have \fBout\fR or
|
||||
\fBinout\fR parameters.
|
||||
.IP \fBtype\fR
|
||||
Contains the data type of the column, and will generally be chosen
|
||||
from the set,
|
||||
\fBbigint\fR, \fBbinary\fR, \fBbit\fR, \fBchar\fR, \fBdate\fR,
|
||||
\fBdecimal\fR, \fBdouble\fR, \fBfloat\fR, \fBinteger\fR,
|
||||
\fBlongvarbinary\fR, \fBlongvarchar\fR, \fBnumeric\fR, \fBreal\fR,
|
||||
\fBtime\fR, \fBtimestamp\fR, \fBsmallint\fR, \fBtinyint\fR,
|
||||
\fBvarbinary\fR, and \fBvarchar\fR. (If the variable has a type that
|
||||
cannot be represented as one of the above, \fBtype\fR will contain
|
||||
a driver-dependent description of the type.)
|
||||
.IP \fBprecision\fR
|
||||
Contains the precision of the column in bits, decimal digits, or the
|
||||
width in characters, according to the type.
|
||||
.IP \fBscale\fR
|
||||
Contains the scale of the column (the number of digits after the radix
|
||||
point), for types that support the concept.
|
||||
.IP \fBnullable\fR
|
||||
Contains 1 if the column can contain NULL values, and 0 otherwise.
|
||||
.PP
|
||||
The \fBparamtype\fR object command allows the script to specify the
|
||||
type and direction of parameter transmission of a variable in a
|
||||
statement. (Some databases provide no method to determine this
|
||||
information automatically and place the burden on the caller to do
|
||||
so.) The \fIdirection\fR, \fItype\fR, \fIprecision\fR, \fIscale\fR,
|
||||
and \fInullable\fR arguments have the same meaning as the
|
||||
corresponding dictionary values in the \fBparams\fR object command.
|
||||
.PP
|
||||
The \fBexecute\fR object command executes the statement. Prior to
|
||||
executing the statement, values are provided for the bound variables
|
||||
that appear in it. If the \fIdict\fR parameter is supplied, it is
|
||||
searched for a key whose name matches the name of the bound
|
||||
variable. If the key is present, its value becomes the substituted
|
||||
variable. If not, the value of the substituted variable becomes a SQL
|
||||
NULL. If the \fIdict\fR parameter is \fInot\fR supplied, the
|
||||
\fBexecute\fR object command searches for a variable in the caller's
|
||||
scope whose name matches the name of the bound variable. If one is
|
||||
found, its value becomes the bound variable's value. If none is found,
|
||||
the bound variable is assigned a SQL NULL as its value. Once
|
||||
substitution is finished, the resulting statement is executed. The
|
||||
return value is a result set object (see \fBtdbc::resultset\fR for
|
||||
details).
|
||||
.PP
|
||||
The \fBresultsets\fR method returns a list of all the result sets that
|
||||
have been returned by executing the statement and have not yet been
|
||||
closed.
|
||||
.PP
|
||||
The \fBallrows\fR object command executes the statement as with the
|
||||
\fBexecute\fR object command, accepting an
|
||||
optional \fIdict\fR parameter giving bind variables. After executing
|
||||
the statement,
|
||||
it uses the \fIallrows\fR object command on the result set (see
|
||||
\fBtdbc::resultset\fR) to construct a list of the results. Finally,
|
||||
the result set is closed. The return value is the list of
|
||||
results.
|
||||
.PP
|
||||
The \fBforeach\fR object command executes the statement as with the
|
||||
\fBexecute\fR object command, accepting an
|
||||
optional \fIdict\fR parameter giving bind variables. After executing
|
||||
the statement,
|
||||
it uses the \fIforeach\fR object command on the result set (see
|
||||
\fBtdbc::resultset\fR) to evaluate the given \fIscript\fR for each row of
|
||||
the results. Finally, the result set is closed, even
|
||||
if the given \fIscript\fR results in a \fBreturn\fR, an error, or
|
||||
an unusual return code.
|
||||
.PP
|
||||
The \fBclose\fR object command removes a statement and any result sets
|
||||
that it has created. All system resources associated with the objects
|
||||
are freed.
|
||||
.SH "EXAMPLES"
|
||||
The following code would look up a telephone number in a directory,
|
||||
assuming an appropriate SQL schema:
|
||||
.PP
|
||||
.CS
|
||||
package require tdbc::sqlite3
|
||||
tdbc::sqlite3::connection create db phonebook.sqlite3
|
||||
set statement [db prepare {
|
||||
select phone_num from directory
|
||||
where first_name = :firstname and last_name = :lastname
|
||||
}]
|
||||
set firstname Fred
|
||||
set lastname Flintstone
|
||||
$statement foreach row {
|
||||
puts [dict get $row phone_num]
|
||||
}
|
||||
$statement close
|
||||
db close
|
||||
.CE
|
||||
.SH "SEE ALSO"
|
||||
encoding(n), tdbc(n), tdbc::connection(n), tdbc::resultset(n), tdbc::tokenize(n)
|
||||
.SH "KEYWORDS"
|
||||
TDBC, SQL, database, connectivity, connection, resultset, statement,
|
||||
bound variable, stored procedure, call
|
||||
.SH "COPYRIGHT"
|
||||
Copyright (c) 2008 by Kevin B. Kenny.
|
||||
'\" Local Variables:
|
||||
'\" mode: nroff
|
||||
'\" End:
|
||||
'\"
|
||||
101
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc_tokenize.n
vendored
Normal file
101
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbc_tokenize.n
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
'\"
|
||||
'\" tdbc_tokenize.n --
|
||||
'\"
|
||||
'\" Copyright (c) 2008 by Kevin B. Kenny.
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution of
|
||||
'\" this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH "tdbc::tokenize" n 8.6 Tcl "Tcl Database Connectivity"
|
||||
'\" .so man.macros
|
||||
'\" IGNORE
|
||||
.if t .wh -1.3i ^B
|
||||
.nr ^l \n(.l
|
||||
.ad b
|
||||
'\" # BS - start boxed text
|
||||
'\" # ^y = starting y location
|
||||
'\" # ^b = 1
|
||||
.de BS
|
||||
.br
|
||||
.mk ^y
|
||||
.nr ^b 1u
|
||||
.if n .nf
|
||||
.if n .ti 0
|
||||
.if n \l'\\n(.lu\(ul'
|
||||
.if n .fi
|
||||
..
|
||||
'\" # BE - end boxed text (draw box now)
|
||||
.de BE
|
||||
.nf
|
||||
.ti 0
|
||||
.mk ^t
|
||||
.ie n \l'\\n(^lu\(ul'
|
||||
.el \{\
|
||||
'\" Draw four-sided box normally, but don't draw top of
|
||||
'\" box if the box started on an earlier page.
|
||||
.ie !\\n(^b-1 \{\
|
||||
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
|
||||
.\}
|
||||
.el \}\
|
||||
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
|
||||
.\}
|
||||
.\}
|
||||
.fi
|
||||
.br
|
||||
.nr ^b 0
|
||||
..
|
||||
'\" # CS - begin code excerpt
|
||||
.de CS
|
||||
.RS
|
||||
.nf
|
||||
.ta .25i .5i .75i 1i
|
||||
..
|
||||
'\" # CE - end code excerpt
|
||||
.de CE
|
||||
.fi
|
||||
.RE
|
||||
..
|
||||
'\" END IGNORE
|
||||
.BS
|
||||
.SH "NAME"
|
||||
tdbc::tokenize \- TDBC SQL tokenizer
|
||||
.SH "SYNOPSIS"
|
||||
.nf
|
||||
package require \fBtdbc 1.0\fR
|
||||
|
||||
\fBtdbc::tokenize\fR \fIstring\fR
|
||||
.fi
|
||||
.BE
|
||||
.SH "DESCRIPTION"
|
||||
.PP
|
||||
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.
|
||||
.PP
|
||||
The \fBtdbc::tokenize\fR 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. Each substring is one of the following:
|
||||
.IP [1]
|
||||
A bound variable, which begins with one of the
|
||||
characters '\fB:\fR', '\fB@\fR', or '\fB$\fR'. The
|
||||
remainder of the string is the variable
|
||||
name and will consist of alphanumeric characters and underscores. (The
|
||||
leading character will be be non-numeric.)
|
||||
.IP [2]
|
||||
A semicolon that separates two SQL statements.
|
||||
.IP [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.
|
||||
.SH "SEE ALSO"
|
||||
tdbc(n), tdbc::connection(n), tdbc::statement(n), tdbc::resultset(n)
|
||||
.SH "KEYWORDS"
|
||||
TDBC, SQL, database, tokenize
|
||||
.SH "COPYRIGHT"
|
||||
Copyright (c) 2008 by Kevin B. Kenny.
|
||||
'\" Local Variables:
|
||||
'\" mode: nroff
|
||||
'\" End:
|
||||
'\"
|
||||
BIN
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbcstub115.lib
vendored
Normal file
BIN
.CondaPkg/env/Library/lib/tdbc1.1.5/tdbcstub115.lib
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user