/usr/share/perl5/DBIx/Class/Schema/Loader/DBI/Component/QuotedDefault.pm is in libdbix-class-schema-loader-perl 0.07045-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 | package DBIx::Class::Schema::Loader::DBI::Component::QuotedDefault;
use strict;
use warnings;
use base 'DBIx::Class::Schema::Loader::DBI';
use mro 'c3';
our $VERSION = '0.07045';
=head1 NAME
DBIx::Class::Schema::Loader::DBI::Component::QuotedDefault -- Loader::DBI
Component to parse quoted default constants and functions
=head1 DESCRIPTION
If C<COLUMN_DEF> from L<DBI/column_info> returns character constants quoted,
then we need to remove the quotes. This also allows distinguishing between
default functions without information schema introspection.
=cut
sub _columns_info_for {
my $self = shift;
my ($table) = @_;
my $result = $self->next::method(@_);
while (my ($col, $info) = each %$result) {
if (my $def = $info->{default_value}) {
$def =~ s/^\s+//;
$def =~ s/\s+\z//;
# remove Pg typecasts (e.g. 'foo'::character varying) too
if ($def =~ /^["'](.*?)['"](?:::[\w\s]+)?\z/) {
$info->{default_value} = $1;
}
# Some DBs (eg. Pg) put parenthesis around negative number defaults
elsif ($def =~ /^\((-?\d.*?)\)(?:::[\w\s]+)?\z/) {
$info->{default_value} = $1;
}
elsif ($def =~ /^(-?\d.*?)(?:::[\w\s]+)?\z/) {
$info->{default_value} = $1;
}
elsif ($def =~ /^NULL:?/i) {
my $null = 'null';
$info->{default_value} = \$null;
}
else {
$info->{default_value} = \$def;
}
}
}
return $result;
}
1;
=head1 SEE ALSO
L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>,
L<DBIx::Class::Schema::Loader::DBI>
=head1 AUTHORS
See L<DBIx::Class::Schema::Loader/AUTHORS>.
=head1 LICENSE
This library is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.
=cut
|