GSP
Quick Navigator

Search Site

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

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TANGRAM::TYPE::DUMP::ANY (3)

.ds Aq ’

NAME

Tangram::Type::Dump::Any - Intuitive DataBase InterFace

CONTENTS

SYNOPSIS



  # ... in a nearby Tangram::Schema structure ...
  SomeClass =>
    { fields =>
      { idbif => {
            -options => { dumper => Data::Dumper,
                        },
            some_field => undef,
            some_property => undef,
            some_attribute => undef,
            each_one => undef,
            gets => undef,
            saved => undef,
        },
        string => {
            cheese => undef,
        },
      },
    };



DESCRIPTION

The <B>idbifB> mapping type collates multiple data members into a single <B>perl_dumpB> (see Tangram::Type::Dump::Perl), <B>storableB> (see Tangram::Type::Dump::Storable) or <B>yamlB> (see Tangram::Type::Dump::YAML) column.

For instance, with the schema definition in the example, all the columns in the example would be serialised via Data::Dumper.

If you stored an object like this:



  $cheese = bless { cheese   => "gouda",
                    gets     => 6,
                    each_one => 9 }, "SomeClass";



You would see something in your database similar to:



  /^--v------v--------v----------------------------^\
  | id | type | cheese | idbif                        |
  >----o------o--------o------------------------------<
  |  1 |   42 |  gouda | { gets => 6, each_one => 9 } |
  \_,--^------^--------^----------------------------._/



(note: the actual output from your SQL Database client may differ from the above)

So, if you’re the sort of person who likes to set their attributes with accessors, but doesn’t like the overhead this places on the RDBMS... then this may help. Note: the real benefits of this mapping type are for when you’re storing more complex data structures than 6 and 9 :-).

You may prefer to use the default dumping type, which is <B>storableB>.

    LINKS TO OTHER OBJECTS

If Tangram encounters another object which <B>is already in storageB> (ie, has been inserted via $storage->insert($foo)), then it will store a Memento. This memento includes the object ID, which is sensitive to schema changes (the ordering of classes in the schema).

If the class implements a px_freeze and px_thaw function, then there will be a Memento that includes the class name of the object, and the data that was returned by the class’ px_freeze method. To be reconstituted, it is called as:



  SomeClass->px_thaw(@data)



See Tangram::Type::Dump for more details on the complicity API.

Please set RETVAL to be the thawed object. (that is, return a single scalar).

    BUT, I REALLY, REALLY HATE SCHEMAS!

However, maybe you are one of those folk who don’t like to declare their attributes, instead peppering hashes willy nilly, then there is another option.

Instead of explicitly listing the fields you want, if you don’t specify any fields at all, then it means save ALL remaining fields into the column. For convenience, -poof is provided as a synonym for -options, so you can write:



    { fields =>
      { idbif => { -poof => # There goes another one!
                   {
                   },
                 }
      },
    }



[ You see, Tangram::Type::Dump::Any isn’t actually an intuitive DB interface. No, an intuitive DB interface is a user interface component, and that title is reserved for Visual Tangram. VT expects to pick up the title with any luck by the end of the 21st century^W RSN!

I Don’t Believe In Fairies is actually what it stands for. It’s a completely arbitrary name; chosen for no reason at all, and certainly not anything to do with Pixie. ]

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TANGRAM::TYPE::DUMP::ANY (3) 2015-10-09

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