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

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

  # ... 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,
        },
      },
    };

The idbif mapping type collates multiple data members into a single perl_dump (see Tangram::Type::Dump::Perl), storable (see Tangram::Type::Dump::Storable) or yaml (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 storable.

If Tangram encounters another object which is already in storage (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).

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. ]

2015-10-09 perl v5.32.1

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

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