First thought is that this looks like the start of exactly what
SQL::Abstract can do... While you said this was in part a perl excercise, you may still want to consider replacing the whole thing or parts (i.e. making your
insert() and
update() methods wrappers for those in SQL::Abstract)..
As for getting the field names in a table, is it necessary? you could assume that the data passed in has valid field names (otherwise it will just sql error).. But anyways, i believe that this will work pretty DB-independently:
my $sth = $dbh->prepare("SELECT * FROM $table WHERE 1=0");
$sth->execute;
my @cols = @{$sth->{NAME}};