I've not looked at the source code to Alzabo or DBIx::DBSchema but 
perhaps it would be possible to define a base class that uses DBI 
functions to get the meta-data.   The DB specific stuff could be done 
with overridden methods?

Personally, I believe there should be more meta-data methods in DBI than 
currently exist.  Perhaps there could even be a $dbh->supports() method 
that indiciated the level of compliance.

Also, there could be some standardisation on what is returned by the 
meta-data methods: currently methods like table_info() use different 
column names depending on the DBD in question and also use different 
qualifiers, for example table() may or may not include the owner or 
catalog name with the table.

I would like to see an object orientated approach that provides methods 
for accessing the meta-data, something like:

my $dbs = $dbh->schema();
my $tables = $dbs->tables();
foreach my $table (@{$tables}) {
   print $table->owner, ".", $table->name, ":\n";
   foreach my $index (@{$table->indexes}) {
     print "\t", $index->name, ":\n";
     foreach my $column (@{$index->columns}) {
       print "\t\t", $column->name, " (", $column->domain, ")\n";
     }
   }
}

This sounds like a big job but I guess that much of the DB specific hard 
work has been done by the authors of Alzabo and DBIx::DBSchema.  This 
could be moved into the DBD or perhaps an associated package 
(DBD::ODBC::Schema for example which would be a subclass of DBD::Schema).

Initially the schema object would be read-only but as things develop it 
could be made read-write.

-- 
   Simon Oliver

Reply via email to