Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

tangram::type::scalar(3pm) [debian man page]

Tangram::Type::Scalar(3pm)				User Contributed Perl Documentation				Tangram::Type::Scalar(3pm)

NAME
Tangram::Type::Scalar - map scalar fields SYNOPSIS
use Tangram; Tangram::Schema->new( classes => { NaturalPerson => { fields => { string => [ qw( name firstName gender ) ], int => [ qw( age ) ], real => [ qw( height weight ) ], $schema = Tangram::Schema->new( classes => { NaturalPerson => { fields => { string => { name => { sql => 'VARCHAR(100)' }, 1stname => { col => 'firstName', sql => 'VARCHAR(100) NULL' }, gender => undef() }, DESCRIPTION
Classes Tangram::Type::String, ::Int and ::Real and ::Ref are responsible for mapping the various subtypes of scalars. The first three map- pings are documented here since they differ very little. See Tangram::Type::Ref::FromMany for information on mapping references. Tangram::Type::String uses DBI's quote() method to quote strings if that method is available, thus making it possible to store binary objects or multiline text in databases that support it (thanks to Marian Kelc <marian.kelc@ruhr-uni-bochum.de> for suggesting this improve- ment). The three predefined typetags "string", "int" and "real" are for the corresponding Perl scalar subtypes. Each scalar field is stored in a single column of the table associated to the class. The persistent fields may be specified either as a hash or as an array of field names. In the hash form, each entry consists in a field name and an associated option hash. The option hash may contain the following fields: * col * sql * automatic "col" sets the name of the column used to store the field's value. This field is optional, it defaults to the persistent field name. Over- ride if the field name is not an acceptable SQL column name. "sql" sets the SQL type of the column. Used by Schema::deploy() when initializing a database. Defaults to 'VARCHAR(255) NULL' for strings, 'INT NULL' for ints and 'REAL NULL' for reals. "automatic", if set to true, tells Tangram not to save the field to storage. This is useful for auto-increment or timestamp columns. The persistent fields may also be specified as an array of strings, in which case the defaults are used. perl v5.8.8 2006-03-29 Tangram::Type::Scalar(3pm)

Check Out this Related Man Page

Tangram::Type::Set::FromMany(3pm)			User Contributed Perl Documentation			 Tangram::Type::Set::FromMany(3pm)

NAME
Tangram::Type::Set::FromMany - maps Set::Object using a link table SYNOPSIS
use Tangram; # or use Tangram::Core; use Tangram::Type::Set::FromMany; $schema = Tangram::Schema->new( classes => { Company => { fields => { set => { # long form employee => { class => 'Person', table => 'Company_employees', coll => 'company', item => 'employee', }, # short form assets => 'Asset', } DESCRIPTION
Maps a reference to a Set::Object. The persistent fields are grouped in a hash under the "set" key in the field hash. The set may contain only objects of persistent classes. These classes must have a common persistent base class. Tangram uses a link table to save the state of the collection. The table has two columns: one contains the id of the container objects; the other contains the ids of the elements. The field names are passed in a hash that associates a field name with a field descriptor. The field descriptor may be either a hash or a string. The hash uses the following fields: * class * aggreg * table * coll * item * deep_update Mandatory field "class" specifies the class of the elements. Optional field "aggreg" specifies that the elements of the collection must be removed (erased) from persistent storage along with the con- taining object. The default is not to aggregate. Optional field "table" sets the name of the link table. This defaults to 'C_F', where C is the class of the containing object and F is the field name. Optional field "coll" sets the name the column containing the ids of the containing objects. This defaults to 'coll'. Optional field "item" sets the name the column containing the ids of the elements. This defaults to 'item'. Optional field "deep_update" specificies that all elements have to be updated automatically when "update" is called on the collection object. Automatic update ensures consisitency between the Perl representation and the DBMS state, but degrades update performance so use it with caution. The default is not to do automatic updates. If the descriptor is a string, it is interpreted as the name of the element's class. This is equivalent to specifying only the "class" field in the hash variant. perl v5.8.8 2006-03-29 Tangram::Type::Set::FromMany(3pm)
Man Page