Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  TANGRAM::TYPE::HASH::SCALAR (3)

.ds Aq ’


Tangram::Type::Hash::Scalar - map Perl hash of scalar keys and values



   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


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
o the id of the container object
o the key of the element in the hash
o 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:
o key_type
o key_sql
o type
o sql
o 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 containing 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.


This mapping was contributed by Gabor Herr <>
Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 TANGRAM::TYPE::HASH::SCALAR (3) 2015-10-09

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.