man Tangram::Type () - mapping individual fields
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. CWstring, CWint, CWreal: see Tangram::Scalar CWdate, CWtime, CWdatetime, CWdmdatetime: see Tangram::DateTime
- Compound Structure types
- CWperl_dump: see Tangram::PerlDump. A CWperl_dump structure may contain any structure which Data::Dumper can dump successfully. CWstorable: see Tangram::Storable. Very much like CWperl_dump, but implemented via the `Storable' serialisation engine. CWyaml: see Tangram::YAML. Very much like CWperl_dump, but implemented via the `YAML' serialisation engine. Doesn't currently work, due to inadequacies in the current Perl YAML implementation. NEW in Tangram 2.08: CWidbif: see Tangram::IDBIF. 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 CWperl_dump or CWidbif mapping is a lot faster and more flexible. CWflat_array: see Tangram::FlatArray CWflat_hash: see Tangram::FlatHash
- References to other objects
- CWref: see Tangram::Ref (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. CWset: see Tangram::Set (implementing an unordered N to N relationship, with all objects sharing a common base class) CWiset: see Tangram::IntrSet (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 values (in the middle of the list), and the CWarray type may contain duplicates (ie, the same element present in seperate places in the list). CWarray : see Tangram::Array (implementing an ordered N to N relationship, with all objects sharing a common base class) CWiarray: see Tangram::IntrArray (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 CWhash type may contain duplicate elements. CWhash : see Tangram::Hash (implementing a keyed N to N relationship, with all objects sharing a common base class) CWihash: see Tangram::IntrHash (implementing a keyed 1 to N relationship, with all objects sharing a common base class)