NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Databases and Data Logic (Score:1)
Short answer -- If you have DBAs who earn their big bucks, do it their way. If not, ask why not; and do it so that your next project will be easier. Data logc belongs in the DB. Logic specific to a specific use of the data belongs in the specific application.
Stored procedures and triggers are typically hidden. DB Neutral
Stored Procs may hide the SQL from the programmers, but embedding the SQL in the 3GL hides the SQL from the DBAs who may be able to optimize the SQL. Same problem as embedding Perl in HTML or vice versa -- a content management system that lets you keep HTML templates so web designers can design 'em without breaking their template-ness and without breaking the embedded Perl (or Python with it's magic whitespace *shudder*) is easier for big projects. Same with big DB projects, you want to have the SQL where the experts can get at it without breaking the Perl or Java.
(ex-Oracle users keep asking IBM when they'll add HINTS to DB2. The answer always is that the DB2 optimizer doesn't need your hints, would only be thrown off by them; and if you want a feeble optimizer that needs to be micro-managed by hints so you feel important, you can go back to using Oracle. DB2 admins have better things to do, like optimizing the IOs to increase throughput, or adding an index where even the optimizer can't do better than a tablescan.)
Coding those non-portable Triggers, Stored Procs by hand will require adjustment on a later port. If that's what it takes, it's worth it. But using tools is better.
If using professional DBA tools, those are all auto-generated from the design drawing, porting is a snap. I haven't fully checked the capabilities of the FL/OSS DBA design tools, I don't know how much of the Trigger/StoredProc/RI feature set they support yet. I may need to check it out soon, since I need to port some data from MySQL to MySQL. It will be a hard port because the PHP WebSite schema changed between versions ... different problem
ASIDE#1 -- The best database I ever used was WANG PACE. It claimed to be relational, but had some pretty OO features before there was a name for that other than "Post-Relational": It was really class/method oriented without the OO Jargon. The rich Data Dictionary cataloged Types for columns by type names, so natural joins could match the FirstName, LastName fields by type even if the column names were different. Types, columns, tables could all have stored procs (exits, methods) registered for and triggered on events. These "exit procs" could be coded in your choice of SQL, C/C++, or COBOL -- interoperably. Relational integrity was a given; a checkbox at on table-def says to reject add w/o parent or auto-create parent; another says to drop parent if last child deleted or not. With RI having Foreign Key declarations, it was trivial to generate default CRUD screens (Create, Retrieve, Update, Delete) with drill-detail, multiple lines of detail, etc. All on TERMCAP-style green-screens in the late 80's. It's taken 20 years for the industry to catch up, *sigh*
ASIDE#2 -- My Second favorite DB was IBM QBE, Query By Example, which iirc also had RI/FK. You built your query by sketching examples of records you wanted on T-diagrams of the table schemata on a 3270 green-screen, using constants in a column, variables to link joins, and a condition box to constrain relations. Elegant -- but really for on-line ad-hoc query, not for programming.
Bill
# I had a sig when sigs were cool
use Sig;
Reply to This