All Manuals > LispWorks® User Guide and Reference Manual > 45 The SQL Package

attribute-type Function

Summary

Returns the type of an attribute.

Package

sql

Signature

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

Arguments
attribute
An attribute from table.
table
A 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 in database.

database defaults to the 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).

Examples

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

*default-database*
list-attribute-types
list-attributes


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:56