=head1 DESCRIPTION
-Uses DBI to query PostgreSQL system tables to determine schema structure.
+Uses DBI to query PostgreSQL system tables to determine schema structure.
=cut
WHERE a.attrelid=? AND attnum>0
AND a.atttypid=t.oid
ORDER BY a.attnum"
- );
+ );
my $index_select = $dbh->prepare(
"SELECT oid, c.relname, i.indkey, i.indnatts, i.indisunique,
AND c.relname = ?
ORDER BY 1;
/) or die "Can't prepare: $@";
-
+
$table_select->execute();
while ( my $tablehash = $table_select->fetchrow_hashref ) {
my $table_name = $$tablehash{'relname'};
- my $table_oid = $$tablehash{'oid'};
+ my $table_oid = $$tablehash{'oid'};
my $table = $schema->add_table(
name => $table_name,
#what is type? type => $table_info->{TABLE_TYPE},
while (my $columnhash = $column_select->fetchrow_hashref ) {
- #data_type seems to not be populated; perhaps there needs to
+ #data_type seems to not be populated; perhaps there needs to
#be a mapping of query output to reserved constants in sqlt?
my $col = $table->add_field(
my @column_names = $table->field_names();
while (my $indexhash = $index_select->fetchrow_hashref ) {
#don't deal with function indexes at the moment
- next if ($$indexhash{'indkey'} eq ''
+ next if ($$indexhash{'indkey'} eq ''
or !defined($$indexhash{'indkey'}) );
my $type;
fields => \@columns,
) || die $table->error;
}
-
+
$fk_select->execute('public',$table_name) or die "Can't execute: $@";
my $fkeys = $fk_select->fetchall_arrayref({});
$DEBUG and print Dumper $fkeys;
);
}
}
-
+
return 1;
}
=head1 AUTHOR
-Scott Cain E<lt>cain@cshl.eduE<gt>, previous author:
+Scott Cain E<lt>cain@cshl.eduE<gt>, previous author:
Paul Harrington E<lt>harringp@deshaw.comE<gt>.
=head1 SEE ALSO