NextPrevUpTopContentsIndex

list-attribute-types

Function
Summary

Returns type information for a table's attributes.

Package

sql

Signature

list-attribute-types table &key database owner => result

Arguments

table

A table.

database

A database.

owner

nil , :all or a string.

Values

result

A list.

Description

The function list-attribute-types returns type information for the attributes in the table given by table .

database has a default value of *default-database*.

If owner is nil , only user-owned attributes are considered. This is the default.

If owner is :all , all attributes are considered.

If owner is a string, this denotes a username and only attributes owned by owner are considered.

result is a list in which each element is a list ( attribute datatype precision scale nullable ). attribute is a string denoting the atribute name. datatype is the vendor-specific type as described in attribute-type. nullable is 1 if the attribute accepts the value NULL, and 0 otherwise.

Example

To print the type of every attribute in the database, do

(loop for tab in 
      (sql:list-tables)
      do 
      (loop for type-info in 
            (sql:list-attribute-types tab)
            do
            (format t "~&Table ~S Attribute ~S Type ~S" 
                    tab
                    (first type-info)
                    (second type-info))))
See also

attribute-type
list-attributes


LispWorks Reference Manual - 12 Mar 2008

NextPrevUpTopContentsIndex