Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Rose::DB::Object::Std::Metadata
Standardized database object metadata.

Rose::DB::Object::Std::Metadata - Standardized database object metadata.


NAME

Rose::DB::Object::Std::Metadata - Standardized database object metadata.


SYNOPSIS


  use Rose::DB::Object::Std::Metadata;

  $meta = Rose::DB::Object::Std::Metadata->new(class => 'Product');

  # ...or...

  # $meta = Rose::DB::Object::Std::Metadata->for_class('Product');

  $meta->table('products');

  $meta->columns

  (

    id          => { type => 'int', primary_key => 1 },

    name        => { type => 'varchar', length => 255 },

    description => { type => 'text' },

    category_id => { type => 'int' },

    status => 

    {

      type      => 'varchar', 

      check_in  => [ 'active', 'inactive' ],

      default   => 'inactive',

    },

    start_date  => { type => 'datetime' },

    end_date    => { type => 'datetime' },

    date_created     => { type => 'timestamp', default => 'now' },  

    last_modified    => { type => 'timestamp', default => 'now' },

  );

  $meta->add_unique_key('name');

  $meta->foreign_keys

  (

    category =>

    {

      class       => 'Category',

      key_columns =>

      {

        category_id => 'id',

      }

    },

  );

  ...


DESCRIPTION

Rose::DB::Object::Std::Metadata is a subclass of the Rose::DB::Object::Metadata manpage that is designed to serve the needs of the Rose::DB::Object::Std manpage objects. See the the Rose::DB::Object::Std manpage documentations for information on what differentiates it from the Rose::DB::Object manpage.

Only the methods that are overridden are documented here. See the the Rose::DB::Object::Metadata manpage documentation for the rest.


OBJECT METHODS

add_primary_key_column COLUMN
This method is an alias for the add_primary_key_columns() method.

add_primary_key_columns COLUMNS
Since the Rose::DB::Object::Std manpage objects must have a single primary key column named ``id'', calling this method with a COLUMNS argument of anything other than the column name ``id'' or a reference to an array containing the column name ``id'' will cause a fatal error.

In general, you do not need to use this method at all since the primary_key_columns() method is hard-coded to always return ``id''.

initialize [ARGS]
This method does the same thing as the the Rose::DB::Object::Metadata manpage method of the same name, with one exception. If there is no column named ``id'' in the list of columns, a scalar primary key column named ``id'' is added to the column list. Then initialization proceeds as usual.

primary_key_columns
Always returns the column name ``id'' (in list context) or a reference to an array containing the column name ``id'' (in scalar context).


AUTHOR

John C. Siracusa (siracusa@gmail.com)


COPYRIGHT

Copyright (c) 2007 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy