Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

tangram::type::array::fromone(3pm) [debian 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)

Check Out this Related Man Page

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

NAME
Tangram::Type - mapping individual fields DESCRIPTION
Tangram's persistent type system is extensible, allowing you to mount your own types and make them persistent. All you have to do is to register your type and provide mapping code. See Tangram::Type::Extending. Tangram comes with built-in support for the following types: Simple Scalar types Supported are strings, integers, real numbers and dates. More types of this ilk are easily added. "string", "int", "real": see Tangram::Type::Scalar "date", "time", "datetime", "dmdatetime": see "Date/Type/Date/DateTime" in Tangram::Type Compound Structure types "perl_dump": see Tangram::Type::Dump::Perl. A "perl_dump" structure may contain any structure which Data::Dumper can dump success- fully. "storable": see Tangram::Type::Dump::Storable. Very much like "perl_dump", but implemented via the `Storable' serialisation engine. "yaml": see Tangram::Type::Dump::YAML. Very much like "perl_dump", but implemented via the `YAML' serialisation engine. Doesn't cur- rently work, due to inadequacies in the current Perl YAML implementation. NEW in Tangram 2.08: "idbif": see Tangram::Type::Dump::Any. Like the above, but can combine multiple object properties into a single database column. `Flat' Array & Hash types Note: these are only actually required if you need to be able to query on individual fields inside the array/hash - otherwise, the "perl_dump" or "idbif" mapping is a lot faster and more flexible. "flat_array": see "Array/Scalar" in Tangram::Type "flat_hash": see "Hash/Scalar" in Tangram::Type References to other objects "ref": see Tangram::Type::Ref::FromMany (implementing an N to 1 relationship, in which any object can be the referant) Sets of other objects Set relationships are closest to the main type of relationship used in an RDBMS. Avid CompSci students will know that the relational database model is based heavily on `Set Theory', which is a subset of a more general concept of `Categories' - generic couplings of a number of classes. In Perl space, these collections are represented via the Set::Object module. Sets may not have duplicate elements, and cannot contain undef values. "set": see Tangram::Type::Set::FromMany (implementing an unordered N to N relationship, with all objects sharing a common base class) "iset": see Tangram::Type::Set::FromOne (implementing an unordered 1 to N relationship, with all objects sharing a common base class) Arrays of other objects The addition to Sets, you can have `Arrays' of objects, represented by a standard Perl array in memory. Arrays may contain undef val- ues (in the middle of the list), and the "array" type may contain duplicates (ie, the same element present in seperate places in the list). "array" : see Tangram::Type::Array::FromMany (implementing an ordered N to N relationship, with all objects sharing a common base class) "iarray": see Tangram::Type::Array::FromOne (implementing an ordered 1 to N relationship, with all objects sharing a common base class) Hashes of other objects Much like the Array types, the Hash types are indexed via a string value, and represented as a Perl hash in memory. These hashes may not contain undef values (those are dropped). The "hash" type may contain duplicate elements. "hash" : see Tangram::Type::Hash::FromMany (implementing a keyed N to N relationship, with all objects sharing a common base class) "ihash": see Tangram::Type::Hash::FromOne (implementing a keyed 1 to N relationship, with all objects sharing a common base class) perl v5.8.8 2006-03-29 Tangram::Type(3pm)
Man Page