in reply to How to structure applications using a RDBMS
Programming Pros
DBA Cons
which is highly inefficient, and should be replaced with a single SQL statement with a join.my $sth1 = MYSQLMODULE::generate_result_set(TABLE => "employees", COLUMNS => qw(name positio +n salary id), WHERE => "department = 'SA +LES'"); $sth1->execute(); while (my @employee = $sth1->fetchrow_array) { my $sth2 = MYSQLMODULE::generate_result_set(TABLE => "commission", COLUMNS => qw(total_com +mision), WHERE => "id = $employe +e[2]"); $sth2->execute(); my @commission = $sth2->fetchrow_array(); print "$employee[0]($employee[1]) = $commission[0]\n"; } ...etc...
I haven't adhered to these rules in the past, for instance - not using stored procedures because I want to make to application as portable as possible, but then having to make the SQL highly optimised for a particular platform to get any sort of performance, means that the application is unable to be easily ported anyway. Think of SQL the same way as everybody in PM thinks of HTML (replacing the Web Designer with the DBA, of course) - get it out of your application, so you don't have to worry about it (make it SEP). If you haven't got a DBA up to the job, just /msg me... :)
rdfield
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to structure applications using a RDBMS
by adamsj (Hermit) on Jul 19, 2002 at 12:44 UTC | |
by rdfield (Priest) on Jul 19, 2002 at 14:37 UTC | |
by adamsj (Hermit) on Jul 19, 2002 at 19:05 UTC |