Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

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

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

NAME
Tangram::Type/Hash/Scalar - map Perl hash of scalar keys and values SYNOPSIS
use Tangram::Core; use Tangram::Type/Hash/Scalar; # always $schema = Tangram::Schema->new( classes => { NaturalPerson => { fields => { flat_hash => { opinions => { table => 'NP_ops', key_sql => 'VARCHAR(10)', type => 'int', sql => 'NUMERIC(1)', }, lucky_numbers => 'int', # use defaults } DESCRIPTION
Maps references to a Perl hash. The persistent fields are grouped in a hash under the "flat_hash" key in the field hash. The hash may contain as keys and values only 'simple' scalars like integers, strings or real numbers. It may not contain references. For hashs of objects, see Tangram::Type::Hash::FromMany and Tangram::Type::Hash::FromOne. Tangram uses a table to save the state of the collection. The table has three columns, which contain * the id of the container object * the key of the element in the hash * the value of the element 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: * key_type * key_sql * type * sql * table The optional fields "key_type" and "type" specify the key and value types of the hash. If the type is "string" Tangram quotes the values as they are passed to the database. Not specifying a "type" is exactly equivalent to specifying "string". Optional field "table" sets the name of the table that contains the elements. This defaults to 'C_F', where C is the class of the contain- ing object and F is the field name. The optional fields "key_sql" and "sql" specify the type that deploy() (see Tangram::Deploy) should use for the column containing the key and value of the hash. If this field is not present, the SQL type is derived from the "type" field: if "type" is "string" (or is absent) VARCHAR(255) is used; otherwise, the "type" field is interpreted as a SQL type. If the descriptor is a string, it is interpreted as the value of the "type" field and all the other fields take the default value. AUTHOR
This mapping was contributed by Gabor Herr <herr@iti.informatik.tu-darmstadt.de> perl v5.8.8 2006-03-29 Tangram::Type::Hash::Scalar(3pm)

Check Out this Related Man Page

Tangram::Type::Array::FromOne(3pm)			User Contributed Perl Documentation			Tangram::Type::Array::FromOne(3pm)

NAME
Tangram::Type::Array::FromOne - map Perl arrays using a foreign key SYNOPSIS
use Tangram; # or use Tangram::Core; use Tangram::Type::Array::FromOne; $schema = Tangram::Schema->new( classes => { Agenda => { fields => { iarray => { # long form entries => { class => 'Entry', coll => 'agenda', }, # or (short form) entries => 'Entry', } DESCRIPTION
This class maps references to a Perl array in an intrusive fashion. The persistent fields are grouped in a hash under the "iarray" key in the field hash. The array may contain only objects of persistent classes. These classes must have a common persistent base class. Tangram uses two columns on the element's table to store: * the id of the object containing the collection * the position of the element in the collection CAUTION: the same object may not be an element of the same collection, in two different objects. This mapping may be used only for one-to- many relationships. 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 * back * coll * slot * 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 "back" sets the name of a field that is inserted in the elements. That field acts as a demand-loaded, read-only reference to the object containing the collection. Optional field "coll" sets the name the column containing the id of the containing object. This defaults to 'C_m', where 'C' is the class of the containing object, and 'm' is the field name. Optional field "slot" sets the name the column containing the id of the containing object. This defaults to 'C_m_slot', where 'C' is the class of the containing object, and 'm' is the field name. The "C" in C_m and C_m_slot are passed through the schema normalisation function before being combined into a column name. 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::Array::FromOne(3pm)
Man Page