O'Reilly logo

Tcl/Tk in a Nutshell by Paul Raines, Jeff Tranter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

database-id

database-id options

This command performs operations on the database associated with the database-id created using a previous database connect command.

database-id SQL-clause [argtypedefs] [args]

Execute the SQL statement SQL-clause, returning the result as a list. If the statement returns a single-column result set, the returned string is a simple list, or an empty string if nothing is found. If the command returns a multiple column result set, a list is returned in which each element is a list representing a single row of the result. If the statement does not return a result set, the command returns OK.

SQL arguments may be given after SQL-clause, where the argument positions are marked with ? in the clause. This is usually used with precompiled statements; see the description in the statement-id command.

Example

db "select firstname, surname from employees, where id = $id"
database-id disconnect

Disconnect the database object from the datasource, removing the command from the interpreter.

database-id set option value

Set a connection-specific option to a value. The supported options and value are listed here:

autocommit boolean

Turns autocommit on or off.

concurrency mode

Set concurrency mode to one of readonly, lock, values, or rowver.

maxrows number

Set the maximum number of rows.

timeout number

Set timeout in seconds.

maxlength number

Set the maximum length of data returned.

rowsetsize number

Set the row set size.

cursortype type

Set the cursor type to type, which must be one of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required