NAME
Rose::DBx::Object::Metadata::Column::Xml - Xml binary large object column metadata.
SYNOPSIS
use Rose::DBx::Object::Metadata::Column::Xml;
$col = Rose::DBx::Object::Metadata::Column::Xml->new(...);
$col->make_methods(...);
...
You could add this XML type to your Rose::DB::Object::Metadata column type
by creating your own Metadata object inherited from Rose::DB::Object::Metadata.
See below:
package Model::MyObjectMetadata;
use Mojo::Base 'Rose::DB::Object::Metadata';
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
$self->extend_column_type_classes;
return $self;
}
sub extend_column_type_classes {
my $self = shift;
my $ctc = {$self->column_type_classes};
@$ctc{qw/xml xmltype ora_xmltype/} = ('Model::Object::Metadata::Column::Xml') x 3; # <-------------
$self->column_type_classes(%$ctc);
return $self;
}
1;
xml, xmltype, ora_xmltype - are aliases to the XML type. You can use any other names you want.
Model DB class may look as follows:
package Model::DB;
use base 'Rose::DBx::AutoReconnect'; # <------------- if you need autoreconnection
# Use a private registry for this class
__PACKAGE__->use_private_registry;
# Set the default domain and type
__PACKAGE__->default_domain('production');
__PACKAGE__->default_type('main');
1;
Then you have to use your "brend new" MyObjectMetadata in your inherited from Rose::DB::Object class as below:
package Model::Object;
use Model::DB;
use Model::MyObjectMetadata; # <-------------
use Mojo::Base qw(Rose::DB::Object);
sub init_db {return Model::DB->new_or_cached}
sub meta_class {return "Model::ObjectMetadata"} # <-------------
1;
And in Scheme class do as below:
package Model::Scheme::AnySchemeClass;
use base qw/Model::Object/;
__PACKAGE__->meta->setup
(
table => 'anytablename',
columns => [
...,
my_xml_field => { type => 'xml'},
...
],
...
);
1;
And that's it!
DESCRIPTION
Objects of this class store and manipulate metadata for long, variable-length character-based columns in a database. Column metadata objects store information about columns (data type, size, etc.) and are responsible for creating object methods that manipulate column values.
This class inherits from Rose::DB::Object::Metadata::Column::Text. Inherited methods that are not overridden will not be documented a second time here. See the Rose::DB::Object::Metadata::Column::Character documentation for more information.
METHOD MAP
get_set
get
get_set
See the Rose::DB::Object::Metadata::Column documentation for an explanation of this method map.
OBJECT METHODS
- type
-
Returns "xml".
AUTHOR
Andrey Chergik (andrey@chergik.ru)
LICENSE
Copyright (c) 2011 by Andrey Chergik. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1;