NAME
DbFramework::Attribute - Attribute class
SYNOPSIS
use DbFramework::Attribute;
my $a = new DbFramework::Attribute($name,$default_value,$is_optional,$data_type);
$a->name($name);
$a->default_value($value);
$a->is_optional($boolean);
$a->references($data_type);
$sql = $a->as_sql;
$s = $a->as_string;
$html = $a->as_html_form_field($value,$type);
$html = $a->as_html_heading;
DESCRIPTION
A DbFramework::Attribute object represents an attribute (column) in a table (entity).
SUPERCLASSES
DbFramework::Util
CLASS METHODS
new($name,$default_value,$is_optional,$data_type)
Create a new DbFramework::Attribute object. $name is the name of the attribute. $default_value is the default value for the attribute. $is_optional should be set to true if the attribute is optional or false. $data_type is a DbFramework::DataType object.
name($name)
If $name is supplied, sets the attribute name. Returns the attribute name.
default_value($value)
If $value is supplied, sets the default value for the attribute. Returns the default value for the attribute.
is_optional($boolean)
If $boolean is supplied, sets the optionality of the attribute. $boolean should evaluate to true or false. Returns the optionality of the attribute.
references($data_type)
If $data_type is supplied, sets the data type of the attribute. $data_type is a DbFramework::DataType object. Returns a DbFramework::DataType object.
bgcolor($bgcolor)
If $color is supplied, sets the background colour for HTML table cells. Returns the current background colour.
as_sql($dbh)
Returns a string which can be used to create a column in an SQL 'CREATE TABLE' statement. $dbh is a DBI handle.
as_html_form_field($value,$type)
Returns an HTML form field representation of the attribute. The HTML field type produced depends on the name of the associated DbFramework::DataType object. This can be overidden by setting $type. $value is the default value to be entered in the generated field.
as_string()
Return attribute details as a text string.
as_html_heading()
Returns a string for use as a column heading cell in an HTML table;
SEE ALSO
AUTHOR
Paul Sharpe
COPYRIGHT
Copyright (c) 1997,1998 Paul Sharpe. England. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.