- Fix tests when the path to perl has spaces in it (GH#19)
- Inline String::CamelCase::wordsplit() due to RT#123030
+ - Get enum values from DBD::Pg if it's new enough
0.07048_01 - 2018-02-23
- Convert from Module::Install to ExtUtils::MakeMaker + Distar (GH#17)
my $dbh = $self->schema->storage->dbh;
my %result;
+ my %raw_result;
if (my $sth = try { $self->_dbh_column_info($dbh, undef, $table->schema, $table->name, '%' ) }) {
COL_INFO: while (my $info = try { $sth->fetchrow_hashref } catch { +{} }) {
) || {};
$column_info = { %$column_info, %$extra_info };
+ $raw_result{$col_name} = $info;
$result{$col_name} = $column_info;
}
$sth->finish;
%result = %lc_result;
}
- return \%result;
+ return wantarray ? (\%result, \%raw_result) : \%result;
}
# Need to override this for the buggy Firebird ODBC driver.
my $self = shift;
my ($table) = @_;
- my $result = $self->next::method(@_);
+ my ($result,$raw) = $self->next::method(@_);
while (my ($col, $info) = each %$result) {
if (my $def = $info->{default_value}) {
}
}
- return $result;
+ return wantarray ? ($result, $raw) : $result;
}
1;
my $self = shift;
my ($table) = @_;
- my $result = $self->next::method(@_);
+ my ($result, $raw) = $self->next::method(@_);
while (my ($col, $info) = each %$result) {
my $data_type = $info->{data_type};
elsif (lc($data_type) eq 'character') {
$info->{data_type} = 'char';
}
- else {
+ # DBD::Pg < 3.5.2 can get the order wrong on Pg >= 9.1.0
+ elsif (
+ ($DBD::Pg::VERSION >= 3.005002 or $self->dbh->{pg_server_version} < 90100)
+ and
+ my $values = $raw->{$col}->{pg_enum_values}
+ ) {
+ $info->{extra}{list} = $values;
+
+ # Store its original name in extra for SQLT to pick up.
+ $info->{extra}{custom_type_name} = $info->{data_type};
+
+ $info->{data_type} = 'enum';
+
+ delete $info->{size};
+ }
+ else {
my ($typetype) = $self->schema->storage->dbh
->selectrow_array(<<EOF, {}, $data_type);
SELECT typtype