MAN page from Old RedHat 7.X perl-SQL-Schema-0.31-8.i386.rpm
SQL::Schema::Table::Column
Section: User Contributed Perl Documentation (3)
Updated: perl v5.6.0
Index NAME
SQL::Schema::Table::Column - A column of a database table
SYNOPSIS
my $column = SQL::Schema::Table::Column->new(%attr);
my $sql = $column->column_definition; print $sql;
print "$column";
DESCRIPTION
`SQL::Schema::Table::Column' is a class for objects representing a databasetable's column. The methods of an instanciated object do allow to access theinformation within a database's data dictionary and to represent them as
SQLcreate statements and the like using the proper
SQL dialect.
Constructors
$column = SQL::Schema::Table::Column->new(%attr);
The
new method instanciates a column object. The object isan in memory representation of a (possible) database table's column.The attributes are given as key value pairs by the hash
`%attr'.Possible keys are:
key required? value description
column_name yes The name of the table's column.
data_type yes number data_length no number data_precision no number data_scale no number nullable no either `Y' o `N'; default: `Y' data_default no a character string approbriate as expression after the `default' keyword (might include quotes)
These keys and their possible values correspond exactly to thedata dictionary view
`all_tab_columns' and are described withinOracle's Server Reference.
$column = SQL::Schema::Table::Column->select($dbh,$table_name,$column_name);
The
select method fetches the attributes required by
newfrom the database and returns the column object. (It calls
newinternally.)
If the column could not be found within the database, the method returns undef.
The method's arguments are as follows:
- `$dbh'
- A database handle as defined by DBI(3).
- `$table_name'
- The name of the table without preceeding schema name.
- `$column_name'
- The name of the column.
Methods
The following attribute methods do return the current valueof the attributes (as handed over to the
new method):
$column_name = $column->name; $data_type = $column->data_type; $data_length = $column->data_length; $data_precision = $column->data_precision; $data_scale = $column->data_scale; $nullable = $column->nullable; $data_default = $column->data_default;
There does exist a speciallity for the
`data_default' method:If the attribute
`data_default' the method
`data_default'returns the content of the attribute with eleminated trailing new line.
The return value of nullable is either `Y' or `N'.This is somewhat uncomfortable for perl programmers.You might want to use the following method instead:
$nullable = $sequence->nullable_bool;
It does return
`1' resp.
`0' where its correspondingattribute method returns
`Y' resp.
`N'.
$sql = $column->column_definition; $sql = "$column";
Returns a string containing the column definition which could be usedas part of an
SQL statements for creation of the corresponding column.This method is overloaded with the string operator. So the two examplesabove are equivalent.
AUTHOR AND COPYRIGHT
SQL::Schema::Table::Column is Copyright (C) 2000, Torsten Hentschel Windmuehlenweg 47 44141 Dortmund Germany
Email: toddAATTbayleys.ping.de
All rights reserved.
You may distribute this package under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
SEE ALSO
DBI(3),
SQL::Schema::Table(3)
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- Constructors
- Methods
- AUTHOR AND COPYRIGHT
- SEE ALSO
This document was created byman2html,using the manual pages.