This file is indexed.

/usr/share/perl5/Class/DBI/Lite/TableInfo.pm is in libclass-dbi-lite-perl 1.026-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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package Class::DBI::Lite::TableInfo;

use strict;
use warnings 'all';
use Class::DBI::Lite::ColumnInfo;


#==============================================================================
sub new
{
  my ($class, $table) = @_;
  return bless {
    table   => $table,
    columns => [ ]
  }, $class;
}# end new()


#==============================================================================
sub table
{
  $_[0]->{table};
}# end table()


#==============================================================================
sub columns
{
  @{ $_[0]->{columns} };
}# end columns()


#==============================================================================
sub column
{
  my ($s, $name) = @_;
  
  my ($item) = grep { $_->{name} eq $name } @{$s->{columns}};
  return $item;
}# end column()


#==============================================================================
sub add_column
{
  my ($s, %column) = @_;
  
  push @{$s->{columns}}, Class::DBI::Lite::ColumnInfo->new( %column );
}# end add_column()

1;# return true:

=pod

=head1 NAME

Class::DBI::Lite::TableInfo - Utility class for database table meta-information.

=head1 SYNOPSIS

  # Methods:
  my $info = Class::DBI::Lite::TableInfo->new( 'users' );
  $info->add_column(
    name          => 'user_id',
    type          => 'integer',
    length        => 10,
    is_nullable   => 0,
    default_value => undef,
    is_pk         => 1,
    key           => 'primary_key',
  );
  my $col = $info->column( 'user_id' );
  
  # Properties:
  my @cols = $info->columns();
  print $info->table; # "users"

=head1 DESCRIPTION

C<Class::DBI::Lite::TableInfo> provides a consistent means to discover the meta-info about
tables and their fields in a database.

=head1 PUBLIC PROPERTIES

=head2 table

Returns the name of the table.

=head2 columns

Returns a list of L<Class::DBI::Lite::ColumnInfo> objects that pertain to the current table.

=head1 PUBLIC METHODS

=head2 new( $table_name )

Returns a new C<Class::DBI::Lite::TableInfo> object for the table named C<$table_name>.

=head2 column( $name )

Returns a L<Class::DBI::Lite:ColumnInfo> object that matches C<$name>.

=head2 add_column( %args )

Adds a new L<Class::DBI::Lite::ColumnInfo> object to the table's collection.

C<%args> is passed to the L<Class::DBI::Lite::ColumnInfo> constructor and should contain its required parameters.

=head1 AUTHOR

John Drago <jdrago_999@yahoo.com>

L<http://www.devstack.com/>

=head1 COPYRIGHT AND LICENSE

Copyright 2008 John Drago <jdrago_999@yahoo.com>, All Rights Reserved.

This software is Free software and may be used and redistributed under the same
terms as perl itself.

=cut