From: Rafael Kitover Date: Tue, 23 Feb 2010 17:27:51 +0000 (-0500) Subject: correct table list for SQL Anywhere X-Git-Tag: 0.06000~85 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d6a0cc2707a03f470ed51371c916c4ea1cfd18cb;p=dbsrgits%2FDBIx-Class-Schema-Loader.git correct table list for SQL Anywhere --- diff --git a/lib/DBIx/Class/Schema/Loader/DBI/SQLAnywhere.pm b/lib/DBIx/Class/Schema/Loader/DBI/SQLAnywhere.pm index 5a451e2..e918952 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/SQLAnywhere.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/SQLAnywhere.pm @@ -24,6 +24,29 @@ See L. =cut +sub _setup { + my $self = shift; + + $self->{db_schema} ||= + ($self->schema->storage->dbh->selectrow_array('select user'))[0]; +} + +sub _tables_list { + my $self = shift; + + my $dbh = $self->schema->storage->dbh; + my $sth = $dbh->prepare(<<'EOF'); +select t.table_name from systab t +join sysuser u on u.user_id = t.creator +where u.user_name = ? +EOF + $sth->execute($self->db_schema); + + my @tables = map @$_, @{ $sth->fetchall_arrayref }; + + return $self->_filter_tables(@tables); +} + # check for IDENTITY columns sub _columns_info_for { my $self = shift;