Thread: misplaced logic
11-22-05, 17:05 #1Registered User
- Join Date
- Nov 2005
Unanswered: misplaced logic
I'm trying to survey problems that exist in php-web applications with db backends, and I saw a mention of a problem that sometimes the application contains logic that ought to be in the db query. For example, a web application may sort a result set (sorting could have been included in the query), or it may use nested loops to match tuples from result sets when a LEFT JOIN would have done the job.
Why would this happen? Perhaps the programmer is used to thinking in php, but doesn't have a strong grasp of sql. Perhaps the programmer wants the web app to be easily portable to any backend dbms, so refrains from using available sql constructs. Who knows...
I realize that this is fairly easy to fix when it is spotted, but I imagine there may be instances of it floating around out there. If anyone has seen this kind of thing and could point me to any specific examples, I would be most grateful. Examples in languages other than php would also be helpful. Thanks.