Next Prev Up Top Contents Index

attribute-type

Function
Summary

Returns the type of an attribute.

Package

sql

Signature

attribute-type attribute table &key database owner => datatype

Arguments

table

A table.

attribute

An attribute from table .

database

A database.

owner

nil , :all or a string.

Values

datatype

A keyword or list denoting a vendor-specific type.

Description

The function attribute-type returns the type of the attribute specified by attribute in the table given by table . The database, in which table is found, 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.

datatype demotes a vendor-specific type. Examples in a MS Access database are :integer , :longchar and :datetime . When datatype is a list, the second element is the length of the type, for example (:varchar 255) .

Example

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

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

list-attribute-types
list-attributes


LispWorks Reference Manual - 25 Jul 2003

Next Prev Up Top Contents Index