use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.04999_12';
+our $VERSION = '0.05003';
=head1 NAME
if(!exists($self->{_cache}->{_mysql_keys}->{$table})) {
my %keydata;
my $dbh = $self->schema->storage->dbh;
- my $sth = $dbh->prepare("SHOW INDEX FROM `$table`");
+ my $sth = $dbh->prepare('SHOW INDEX FROM '.$self->_table_as_sql($table));
$sth->execute;
while(my $row = $sth->fetchrow_hashref) {
next if $row->{Non_unique};
sub _extra_column_info {
no warnings 'uninitialized';
- my ($self, $info) = @_;
+ my ($self, $table, $col, $info, $dbi_info) = @_;
my %extra_info;
- if ($info->{mysql_is_auto_increment}) {
+ if ($dbi_info->{mysql_is_auto_increment}) {
$extra_info{is_auto_increment} = 1
}
- if ($info->{mysql_type_name} =~ /\bunsigned\b/i) {
+ if ($dbi_info->{mysql_type_name} =~ /\bunsigned\b/i) {
$extra_info{extra}{unsigned} = 1;
}
- if ($info->{mysql_values}) {
- $extra_info{extra}{list} = $info->{mysql_values};
+ if ($dbi_info->{mysql_values}) {
+ $extra_info{extra}{list} = $dbi_info->{mysql_values};
}
-# XXX we need to distinguish between DEFAULT CURRENT_TIMESTAMP and DEFAULT 'foo'
-# somehow, but DBI column_info doesn't preserve quotes.
- if ($info->{COLUMN_DEF} =~ /^CURRENT_TIMESTAMP\z/i) {
+ if ( $dbi_info->{COLUMN_DEF} =~ /^CURRENT_TIMESTAMP\z/i
+ && $dbi_info->{mysql_type_name} =~ /^TIMESTAMP\z/i) {
+
$extra_info{default_value} = \'CURRENT_TIMESTAMP';
}