There is an interesting project on sourceforge called Alzabo, which
provides an html database interface using DBI, Perl with mason and
mod_perl/apache for both design and browsing of database tables. It uses
mysql and/or oracle and/or postgresql.
It is pretty far along and I have found it to be useful.
project home page is http://alzabo.sourceforge.net/
A snippet from the Announcement of 0.33 (version is up to 0.43 now):
"Alzabo is a program and a module, with two core functions. Its first use
is as a data modelling tool. Through either a schema creation interface or
a perl program, you can create a set of schema, table, column, etc.
objects to represent your data model. Alzabo is also capable of reverse
engineering your data model from an existing system.
Its second function is as an RDBMS to object mapping system. Once you have
created a schema, you can use the Alzabo::Runtime::Table and
Alzabo::Runtime::Row classes to access its data. These classes offer a
high level interface to common operations such as SQL SELECT, INSERT,
DELETE, and UPDATE commands."
BobG
> > I am a new to the world of databases and I am having problems trying to
> > return the table structure in an mSQL database using the DBI module. If
> > anyone could help please. I dont seem to be able even to come up with a
> > proper syntax not recognize the right handle or atribute.
>
>You could read the docs for the DBMS you're using - it will tell you
>which tables, views or proceedures provide that information.
>
>If you want a more portable solution look at the DBI tables, table_info,
>type_info, etc. Below is a simple script that gets a list of tables and
>looks up the column names for each table found.
>
>--
>Simon Oliver
>
>#!/usr/bin/perl -w
>use DBI;
>use strict;
>
>my ($dsn, $dbd, $uid, $pwd, $attr);
>
>$dbd = 'ODBC';
>$dsn = 'my_dsn';
>$uid = ''; $pwd = '';
>$attr = {PrintError=>0, RaiseError=>1};
>
># make a connection
>my $dbh = DBI->connect("dbi:$dbd:$dsn", $uid, $pwd, $attr)
> or die "Can't connect to '$dsn' using '$dbd'\n";
>
># get list of tables
>my @tables = $dbh->tables();
>
>foreach my $table (@tables) {
> my ($sql, $sth);
> # you may need to quote the table name?
> $sql = qq{SELECT * from $table WHERE 1=0};
> eval {
> $sth = $dbh->prepare($sql);
> $sth->execute();
> };
>
> if ($@) {
> print "$table: Error retrieving column names:\n\t", $@, "\n";
> } else {
> print "$table:\n\t", join("\n\t", @{$sth->{NAME}}), "\n";
> $sth->finish();
> }
>}
>
>$dbh->disconnect();