DbFramework::Attribute - Attribute class
use DbFramework::Attribute; my $a = new DbFramework::Attribute($name,$default_value,$is_optional,$data_type); $name = $a->name($name); $value = $a->default_value($value); $opt = $a->is_optional($boolean); $type = $a->references($data_type); $bgc = $a->bgcolor($bgcolor); $sql = $a->as_sql; $s = $a->as_string; $html = $a->as_html_form_field($value,$type); $html = $a->as_html_heading($bgcolor);
A DbFramework::Attribute object represents an attribute (column) in a table (entity).
DbFramework::Util
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.
If $name is supplied sets the attribute name. Returns the attribute name.
If $value is supplied sets the default value for the attribute. $value should be compatible with the the data type set by references(). Returns the default value for the attribute.
If $boolean is supplied sets the optionality of the attribute (i.e. whether it can contain NULLs.) $boolean should evaluate to true or false. Returns the optionality of the attribute.
If $data_type is supplied sets the data type of the attribute. $data_type is an ANSII data type object i.e. DbFramework::DataType::ANSII or a driver-specific object e.g. DbFramework::DataType::Mysql. Returns the data type object.
If $color is supplied sets the background colour for HTML table headings returned by as_html_heading(). Returns the current background colour.
Returns a string which can be used to create a column in an SQL 'CREATE TABLE' statement. $dbh is a DBI handle.
Returns an HTML form field representation of the attribute. The HTML field type produced depends on the name of object returned by data_type(). This can be overidden by setting $type. $value is the default value to be entered in the generated field.
Return attribute details as a text string.
Returns a string for use as a column heading cell in an HTML table. $bgcolor is the background colour to use for the heading.
DbFramework::DataType::ANSII and DbFramework::DataType::Mysql.
Paul Sharpe <paul@miraclefish.com>
Copyright (c) 1997,1998,1999 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.
To install DbFramework::Key, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DbFramework::Key
CPAN shell
perl -MCPAN -e shell install DbFramework::Key
For more information on module installation, please visit the detailed CPAN module installation guide.