/usr/share/perl5/Rose/DB/Object/Metadata/UniqueKey.pm is in librose-db-object-perl 1:0.797-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | package Rose::DB::Object::Metadata::UniqueKey;
use strict;
use Rose::DB::Object::Metadata::Util qw(perl_quote_value);
use Rose::DB::Object::Metadata::ColumnList;
our @ISA = qw(Rose::DB::Object::Metadata::ColumnList);
our $VERSION = '0.782';
use Rose::Object::MakeMethods::Generic
(
'scalar --get_set_init' =>
[
'name'
],
boolean => 'has_predicate',
);
sub init_name { join('_', shift->column_names) || undef }
sub perl_array_definition
{
'[ ' . join(', ', map { perl_quote_value($_) } shift->column_names) . ' ]'
}
sub perl_object_definition
{
my($self) = shift;
return ref($self) . '->new(name => ' . perl_quote_value($self->name) .
', columns => [ ' .
join(', ', map { perl_quote_value($_) } $self->column_names) . ' ])';
}
1;
__END__
=head1 NAME
Rose::DB::Object::Metadata::UniqueKey - Unique key metadata.
=head1 SYNOPSIS
use Rose::DB::Object::Metadata::UniqueKey;
$uk = Rose::DB::Object::Metadata::UniqueKey->new(
columns => [ 'name', 'color' ]);
MyClass->meta->add_unique_key($uk);
...
=head1 DESCRIPTION
Objects of this class store and manipulate metadata for unique keys in a database table. Each unique key is made up of one or more columns.
=head1 OBJECT METHODS
=over 4
=item B<add_column [COLUMNS]>
This method is an alias for the L<add_columns|/add_columns> method.
=item B<add_columns [COLUMNS]>
Add COLUMNS to the list of columns that make up the unique key. COLUMNS must be a list or reference to an array of column names or L<Rose::DB::Object::Metadata::Column>-derived objects.
=item B<columns [COLUMNS]>
Get or set the list of columns that make up the unique key. COLUMNS must a list or reference to an array of column names or L<Rose::DB::Object::Metadata::Column>-derived objects.
This method returns all of the columns that make up the unique key. Each column is a L<Rose::DB::Object::Metadata::Column>-derived column object if the unique key's L<parent|/parent> has a column object with the same name, or just the column name otherwise. In scalar context, a reference to an array of columns is returned. In list context, a list is returned.
=item B<column_names>
Returns a list (in list context) or reference to an array (in scalar context) of the names of the columns that make up the unique key.
=item B<delete_columns>
Delete the entire list of columns that make up the unique key.
=item B<name [NAME]>
Get or set the name of the unique key. This name should be unique among all unique keys for a given table. Traditionally, it is the name of the index that the database uses to maintain the unique key, but practices vary. If left undefined, the default value is a string created by joining the L<column_names|/column_names> with underscores.
=item B<parent [META]>
Get or set the L<Rose::DB::Object::Metadata>-derived object that this unique key belongs to.
=back
=head1 AUTHOR
John C. Siracusa (siracusa@gmail.com)
=head1 LICENSE
Copyright (c) 2010 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.
|