code style/data structure questions
jproctor at marlboro.edu
Fri Oct 11 21:39:59 CDT 2002
I'm developing an rdb structure with a couple dozen tables (so far), and a
need to do CGI-driven show table/show record detail/add record/edit record
operations on a handful of them. All of those operations require
multiple, occasionally complex joins, though, and the various detail pages
require joins through a cross-reference table instead of a simple foreign
So I started modeling the db structure, and including in the model
information about the 'views' I expect for each table, which columns to
show, in which order, and with what formatting. My "show table" script
just gets the name of the table as an argument (for example,
"show.cgi?table=plasmids") and it calls the table-generator method on the
control object with that as an argument. This method (via many private
methods it calls) generates the SQL, executes it, applies any special
formatting, and spits out a complete HTML table for me.
Sounds cool? I hope?
I've been working solo too long; it's time to take a step back and make
sure I'm on track. One of the data structures I've developed is so
contorted I could barely get my brain around it today. So I took a couple
hours this afternoon and typed up some notes and questions in hopes of
soliciting a little feedback from other programmers.
Warning: proceed at your own risk if you're not already familiar with
database programming and OO Perl.
So, my collected thoughts are at
At least one person has already asked for a small example (trust me, you
don't want 60 kB of code). I'll probably add that over the weekend.
More information about the Pioneer-valley-pm