## Tclodbc 2.1 Utility Procedure Reference

ColTypes DumpSchema DumpTable FieldFormat Justification LoadSchema LoadSql LoadTable SqlDelete SqlInsert SqlSelect SqlShell SqlTimeToTclTime SqlUpdate TableDef TableDefToSql TclTimeToSqlTime TkTableInit TkTableRead

## ColTypes

Return list of column types for given columns. This list can be used as statement argument specification.

### Parameters

- db : database object
- table : table name
- columns : column names

## DumpSchema

Dumps whole database schema to a named file.

### Parameters

- db : database object name
- filename : filename

## DumpTable

Dump the contents of a named table to a file. The filename may be given explicitly, but if not, a default name of the form $tablename.d is used.

The .d file format is the following: 1st line contains the data column names. from 2rd line forward, the data in tcl list format.

### Parameters

- db : database object name
- table : database table name
- ?filename? : filename, optional

## FieldFormat

Formats given list of fields for output

### Parameters

- fielddef : field defininition list, {coltype ?fieldlenght?}
- ?data? : field data, if empty, return a delimiter row

## Justification

Returns default justification of a column, right, left or center

### Parameters

- coltype : column type description, as returned by "stmt columns type precision scale displaysize"

## LoadSchema

Loads whole database schema from a named file.

### Parameters

- db : database object name
- filename : filename
- verbose : puts lines before executing, useful when debugging sql

## LoadSql

Loads sql from a file to a database. The input file should contain one sql statement per line.

### Parameters

- db : database object name
- filename : filename

## LoadTable

Loads the contents of a named table from a file. The filename may be given explicitly, but if not, a default name of the form $tablename.d is used. The file format is assumed to be of the form generated by DumpData procedure, described above.

### Parameters

- db : database object name
- table : database table name
- ?filename? : filename, optional

## SqlDelete

Create command for creating a delete statement for given table and columns.

### Parameters

- db : database object
- stmt : statement name
- table : table name
- keycols : key column names
- ?mode? : mode, default is eval

## SqlInsert

Return command for creating a insert statement for given table and columns. Mode determines the action for the command. Useful modes are e.g. eval, return and puts.

### Parameters

- db : database object
- stmt : statement name
- table : table name
- columns : column names
- ?mode? : mode, default is eval

## SqlSelect

Return command for creating a select statement for given table and columns. Mode determines the action for the command. Useful modes are e.g. eval, return and puts.

### Parameters

- db : database object
- stmt : statement name
- table : table name
- datacols : data column names
- keycols : key column names
- ?mode? : mode, default is eval

## SqlShell

Very simple sql shell. Execute given statements and return data in columnar format.

### Parameters

- db : db connection object

## SqlTimeToTclTime

Returns tcl time in seconds

### Parameters

- sqltime : sql timestamp of the form YYYY-MM-DD ?HH:MM:SS?

## SqlUpdate

Return command for creating a update statement for given table and columns. Mode determines the action for the command. Useful modes are e.g. eval, return and puts.

### Parameters

- db : database object
- stmt : statement name
- table : table name
- datacols : data column names
- keycols : key column names
- ?mode? : mode, default is eval

## TableDef

Return the definition of a named database table. The definition consist of a list {tablename coldefs indexdefs}

### Parameters

- db : database object name
- table : database table name

## TableDefToSql

Transforms a TableDef as returned by procedure TableDef to a list of driver specific sql data definition statements.

### Parameters

- db : database object name
- tabledef : database table name

## TclTimeToSqlTime

Returns sql timestamp of the form YYYY-MM-DD HH:MM:SS

### Parameters

- tcltime : tcl time as returned by [clock seconds]

## TkTableInit

Initialize tk table widget for a given result set

### Parameters

- table : tktable widget name
- stmt : the name of a statement object

## TkTableRead

Display whole result set in a tk table widget. The statement object should be executed before calling this

### Parameters

- stmt : the name of a statement object
- table : tktable widget name