root/lang/perl/DBIx-Class-ProxyTable/lib/DBIx/Class/ProxyTable/AutoCreateTable/SQLite.pm @ 3717

Revision 3717, 0.7 kB (checked in by nekokak, 5 years ago)

lang/perl/DBIx-Class-ProxyTable?: Initial import

Line 
1package DBIx::Class::ProxyTable::AutoCreateTable::SQLite;
2use strict;
3use warnings;
4use base 'DBIx::Class::ProxyTable::AutoCreateTable';
5
6sub _get_table {
7    my ($class, $rs, $new_table) = @_;
8
9    my $base_table = $rs->result_source->schema->source_registrations->{$rs->result_source->source_name}->name;
10    for my $table ( @{$rs->result_source->schema->storage->dbh->selectcol_arrayref('select sql from sqlite_master')} ) {
11        if ( $table =~ /^CREATE TABLE $base_table \(/ ) {
12            $table =~ s/$base_table/$new_table/;
13            return $table;
14        }
15    }
16}
171;
18
19__END__
20
21=head1 NAME
22
23DBIx::Class::ProxyTable::AutoCreateTable::SQLite - auto create sqlite table.
24
25=head1 METHOD
26
27=head2 _get_table
28
Note: See TracBrowser for help on using the browser.