X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI%2FSQLite.pm;h=03a7134160f14827208e233e92ed17a06bab6a12;hb=41ef22da3417549e4b5eedd025cca17278bd1d72;hp=2e6696c5648c5c08449f8b3a1ba270b111159fe0;hpb=7507c8ce0703993b79b31bf90144e28ef97d4a9d;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm b/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm index 2e6696c..03a7134 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm @@ -7,7 +7,7 @@ use Carp::Clan qw/^DBIx::Class/; use Text::Balanced qw( extract_bracketed ); use Class::C3; -our $VERSION = '0.04000'; +our $VERSION = '0.04999_06'; =head1 NAME @@ -52,6 +52,7 @@ sub _sqlite_parse_table { my @rels; my @uniqs; + my %auto_inc; my $dbh = $self->schema->storage->dbh; my $sth = $self->{_cache}->{sqlite_master} @@ -110,6 +111,11 @@ sub _sqlite_parse_table { push(@uniqs, [ $name => \@cols ]); } + if ($col =~ /AUTOINCREMENT/i) { + $col =~ /^(\S+)/; + $auto_inc{lc $1} = 1; + } + next if $col !~ /^(.*\S)\s+REFERENCES\s+(\w+) (?: \s* \( (.*) \) )? /ix; my ($cols, $f_table, $f_cols) = ($1, $2, $3); @@ -137,7 +143,21 @@ sub _sqlite_parse_table { }); } - return { rels => \@rels, uniqs => \@uniqs }; + return { rels => \@rels, uniqs => \@uniqs, auto_inc => \%auto_inc }; +} + +sub _extra_column_info { + my ($self, $table, $col_name, $sth, $col_num) = @_; + my %extra_info; + + $self->{_sqlite_parse_data}->{$table} ||= + $self->_sqlite_parse_table($table); + + if ($self->{_sqlite_parse_data}->{$table}->{auto_inc}->{$col_name}) { + $extra_info{is_auto_increment} = 1; + } + + return \%extra_info; } sub _table_fk_info {