Initial Commit

This commit is contained in:
Riley Schneider
2025-12-03 16:38:10 +01:00
parent c5e26bf594
commit b732d8d4b5
17680 changed files with 5977495 additions and 2 deletions

View File

@@ -0,0 +1,146 @@
package DBIx::Class::ResultSourceProxy::Table;
use strict;
use warnings;
use base qw/DBIx::Class::ResultSourceProxy/;
use DBIx::Class::ResultSource::Table;
use Scalar::Util 'blessed';
use namespace::clean;
__PACKAGE__->mk_classdata(table_class => 'DBIx::Class::ResultSource::Table');
__PACKAGE__->mk_classdata('table_alias'); # FIXME: Doesn't actually do
# anything yet!
sub _init_result_source_instance {
my $class = shift;
$class->mk_classdata('result_source_instance')
unless $class->can('result_source_instance');
my $table = $class->result_source_instance;
my $class_has_table_instance = ($table and $table->result_class eq $class);
return $table if $class_has_table_instance;
my $table_class = $class->table_class;
$class->ensure_class_loaded($table_class);
if( $table ) {
$table = $table_class->new({
%$table,
result_class => $class,
source_name => undef,
schema => undef
});
}
else {
$table = $table_class->new({
name => undef,
result_class => $class,
source_name => undef,
});
}
$class->result_source_instance($table);
return $table;
}
=head1 NAME
DBIx::Class::ResultSourceProxy::Table - provides a classdata table
object and method proxies
=head1 SYNOPSIS
__PACKAGE__->table('cd');
__PACKAGE__->add_columns(qw/cdid artist title year/);
__PACKAGE__->set_primary_key('cdid');
=head1 METHODS
=head2 add_columns
__PACKAGE__->add_columns(qw/cdid artist title year/);
Adds columns to the current class and creates accessors for them.
=cut
=head2 table
__PACKAGE__->table('tbl_name');
Gets or sets the table name.
=cut
sub table {
my ($class, $table) = @_;
return $class->result_source_instance->name unless $table;
unless (blessed $table && $table->isa($class->table_class)) {
my $table_class = $class->table_class;
$class->ensure_class_loaded($table_class);
$table = $table_class->new({
$class->can('result_source_instance')
? %{$class->result_source_instance||{}}
: ()
,
name => $table,
result_class => $class,
});
}
$class->mk_classdata('result_source_instance')
unless $class->can('result_source_instance');
$class->result_source_instance($table);
return $class->result_source_instance->name;
}
=head2 table_class
__PACKAGE__->table_class('DBIx::Class::ResultSource::Table');
Gets or sets the table class used for construction and validation.
=head2 has_column
if ($obj->has_column($col)) { ... }
Returns 1 if the class has a column of this name, 0 otherwise.
=head2 column_info
my $info = $obj->column_info($col);
Returns the column metadata hashref for a column. For a description of
the various types of column data in this hashref, see
L<DBIx::Class::ResultSource/add_column>
=head2 columns
my @column_names = $obj->columns;
=head1 FURTHER QUESTIONS?
Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
=head1 COPYRIGHT AND LICENSE
This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
redistribute it and/or modify it under the same terms as the
L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.
=cut
1;

View File

@@ -0,0 +1,80 @@
=for comment POD_DERIVED_INDEX_GENERATED
The following documentation is automatically generated. Please do not edit
this file, but rather the original, inline with DBIx::Class::ResultSourceProxy::Table
at lib/DBIx/Class/ResultSourceProxy/Table.pm
(on the system that originally ran this).
If you do edit this file, and don't want your changes to be removed, make
sure you change the first line.
=cut
=head1 NAME
DBIx::Class::ResultSourceProxy::Table - provides a classdata table
object and method proxies
=head1 SYNOPSIS
__PACKAGE__->table('cd');
__PACKAGE__->add_columns(qw/cdid artist title year/);
__PACKAGE__->set_primary_key('cdid');
=head1 METHODS
=head2 add_columns
__PACKAGE__->add_columns(qw/cdid artist title year/);
Adds columns to the current class and creates accessors for them.
=head2 table
__PACKAGE__->table('tbl_name');
Gets or sets the table name.
=head2 table_class
__PACKAGE__->table_class('DBIx::Class::ResultSource::Table');
Gets or sets the table class used for construction and validation.
=head2 has_column
if ($obj->has_column($col)) { ... }
Returns 1 if the class has a column of this name, 0 otherwise.
=head2 column_info
my $info = $obj->column_info($col);
Returns the column metadata hashref for a column. For a description of
the various types of column data in this hashref, see
L<DBIx::Class::ResultSource/add_column>
=head2 columns
my @column_names = $obj->columns;
=head1 INHERITED METHODS
=over 4
=item L<DBIx::Class::ResultSource>
L<add_column|DBIx::Class::ResultSource/add_column>, L<add_columns|DBIx::Class::ResultSource/add_columns>, L<add_relationship|DBIx::Class::ResultSource/add_relationship>, L<add_unique_constraint|DBIx::Class::ResultSource/add_unique_constraint>, L<add_unique_constraints|DBIx::Class::ResultSource/add_unique_constraints>, L<column_info|DBIx::Class::ResultSource/column_info>, L<column_info_from_storage|DBIx::Class::ResultSource/column_info_from_storage>, L<columns|DBIx::Class::ResultSource/columns>, L<columns_info|DBIx::Class::ResultSource/columns_info>, L<has_column|DBIx::Class::ResultSource/has_column>, L<has_relationship|DBIx::Class::ResultSource/has_relationship>, L<primary_columns|DBIx::Class::ResultSource/primary_columns>, L<relationship_info|DBIx::Class::ResultSource/relationship_info>, L<relationships|DBIx::Class::ResultSource/relationships>, L<remove_column|DBIx::Class::ResultSource/remove_column>, L<remove_columns|DBIx::Class::ResultSource/remove_columns>, L<result_class|DBIx::Class::ResultSource/result_class>, L<resultset_attributes|DBIx::Class::ResultSource/resultset_attributes>, L<resultset_class|DBIx::Class::ResultSource/resultset_class>, L<sequence|DBIx::Class::ResultSource/sequence>, L<set_primary_key|DBIx::Class::ResultSource/set_primary_key>, L<source_info|DBIx::Class::ResultSource/source_info>, L<source_name|DBIx::Class::ResultSource/source_name>, L<unique_constraint_columns|DBIx::Class::ResultSource/unique_constraint_columns>, L<unique_constraint_names|DBIx::Class::ResultSource/unique_constraint_names>, L<unique_constraints|DBIx::Class::ResultSource/unique_constraints>
=back
=head1 FURTHER QUESTIONS?
Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
=head1 COPYRIGHT AND LICENSE
This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
redistribute it and/or modify it under the same terms as the
L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.