use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
+__PACKAGE__->mk_group_accessors('simple', qw/
+ case_sensitive_collation
+/);
+
our $VERSION = '0.05003';
=head1 NAME
=cut
+sub _is_case_sensitive {
+ my $self = shift;
+
+ return $self->case_sensitive_collation ? 1 : 0;
+}
+
+sub _setup {
+ my $self = shift;
+
+ $self->next::method;
+
+ my $dbh = $self->schema->storage->dbh;
+
+ my ($collation_name) = $dbh->selectrow_array(<<'EOS');
+SELECT collation_name
+FROM sys.databases
+WHERE name = DB_NAME()
+EOS
+
+ my ($sensitivity) = $collation_name =~ /(C\w)_[A-z]+\z/;
+
+ $self->case_sensitive_collation($sensitivity eq 'CS' ? 1 : 0);
+}
+
+sub _lc {
+ my ($self, $name) = @_;
+
+ return $self->case_sensitive_collation ? $name : lc($name);
+}
+
sub _tables_list {
my ($self, $opts) = @_;
my @keydata;
while (my $row = $sth->fetchrow_hashref) {
- push @keydata, lc $row->{COLUMN_NAME};
+ push @keydata, $self->_lc($row->{COLUMN_NAME});
}
return \@keydata;
while (my $row = eval { $sth->fetchrow_hashref }) {
my $fk = $row->{FK_NAME};
- push @{$local_cols->{$fk}}, lc $row->{FKCOLUMN_NAME};
- push @{$remote_cols->{$fk}}, lc $row->{PKCOLUMN_NAME};
+ push @{$local_cols->{$fk}}, $self->_lc($row->{FKCOLUMN_NAME});
+ push @{$remote_cols->{$fk}}, $self->_lc($row->{PKCOLUMN_NAME});
$remote_table->{$fk} = $row->{PKTABLE_NAME};
}
my $constraints;
while (my $row = $sth->fetchrow_hashref) {
my $name = $row->{constraint_name};
- my $col = lc $row->{column_name};
+ my $col = $self->_lc($row->{column_name});
push @{$constraints->{$name}}, $col;
}