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::Dump::Perl(3pm)				User Contributed Perl Documentation			    Tangram::Type::Dump::Perl(3pm)

NAME
Tangram::Type::Dump::Perl - map any Perl object as scalar dump SYNOPSIS
use Tangram::Core; use Tangram::Type::Dump::Perl; # always $schema = Tangram::Schema->new( classes => { NaturalPerson => { fields => { perl_dump => { diary => # diary is a perl hash { col => 'diarydata', sql => 'TEXT', indent => 0, terse => 1, purity => 0 }, lucky_numbers => 'int', # use defaults } DESCRIPTION
Maps arbitrary Perl data structures by serializing to a string representation. The persistent fields are grouped in a hash under the "perl_dump" key in the field hash. Serialization is done by Data::Dumper, which traverses the Perl data structure and creates a string representation of it. The resulting string will be mapped to the DBMS as a scalar value. During restore, the scalar value will be eval'd to reconstruct the original data structure. As of Tangram 2.07.1, persistent references are safely handled via the Tangram::Type::Dump utility class. 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: * col * sql * indent * terse * purity The optional fields "col" and "sql" specify the column name and the column type for the scalar value in the database. If not present, "col" defaults to the field name and "sql" defaults to VARCHAR(255). Values will be always quoted as they are passed to the database. The remaining optional fields control the serialization process. They will be passed down to Data::Dumper as values to the corresponding Data::Dumper options. The default settings are: no indentation ("indent=0"), compact format ("terse=1"), and quick dump ("purity=0"). AUTHOR
This mapping was contributed by Gabor Herr <herr@iti.informatik.tu-darmstadt.de> perl v5.8.8 2006-03-29 Tangram::Type::Dump::Perl(3pm)
Man Page