Re: Decouple SQL queries from class in OOP design
- From: "Mikito Harakiri" <mikharakiri_nospaum@xxxxxxxxx>
- Date: 25 Nov 2005 09:47:31 -0800
Daniel Parker wrote:
> An update operation may
> involve updates to several tables, "if exists then update else insert"
> logic, checks on other tables, etc. and this logic can be conveniently
> collected in the stored procedure.
Merge operation? (Often called upsert).
As for complex insert operation, why there might be more than one place
in the program where I store the shopping cart? OK, suppose there is,
then the arguments to the storeCart stored procedure have to be rather
complex -- array of items.
The point of creating a function is to abstract some nontrivial
behaviour in it. Inserting a master record and a set of child records
is simple. For me it would take the same amount of time learning how to
invoke the function properly, versus calling the DML statements
directly. I have to be familiar with database schema, of course. The
idea that database application programminng can be schema agnostic is
nonsence.
> Not so silly, but the problem here is that the ANSII standard dosesn't
> support returning arbitrary numbers of rows through SELECT statements.
> SYBASE does support that, and with SYBASE you have a lot of room to
> play with how the query is implemented without affecting the client
> application, assuming, of course, some simple database accessor layer
> in the middle. For example, you can implement the stored procedure
> with one select statement, then change to two select statements, then
> add some new attributes, change an attribute name in a table but alias
> it to the old name, use some secret Sybase techniques to force an index
> if the query takes forever - you can do all of these things without
> having to recompile your C, C++ or Java client app. But ANSII and
> Oracle don't support this, and SYBASE has almost disappeared off the
> database landscape, so I don't do this anymore.
If that feature mattered, the big three would give no second thought
implementing it. There is not a lot of new development in the database
landscape happening nowadays.
.
- Follow-Ups:
- Re: Decouple SQL queries from class in OOP design
- From: Daniel Parker
- Re: Decouple SQL queries from class in OOP design
- References:
- Decouple SQL queries from class in OOP design
- From: Hongyu
- Re: Decouple SQL queries from class in OOP design
- From: Robert C . Martin
- Re: Decouple SQL queries from class in OOP design
- From: Mikito Harakiri
- Re: Decouple SQL queries from class in OOP design
- From: Bruno Desthuilliers
- Re: Decouple SQL queries from class in OOP design
- From: Mikito Harakiri
- Re: Decouple SQL queries from class in OOP design
- From: JXStern
- Re: Decouple SQL queries from class in OOP design
- From: Mikito Harakiri
- Re: Decouple SQL queries from class in OOP design
- From: Daniel Parker
- Decouple SQL queries from class in OOP design
- Prev by Date: Re: Decouple SQL queries from class in OOP design
- Next by Date: Re: Model-View-Presenter (MVP) question
- Previous by thread: Re: Decouple SQL queries from class in OOP design
- Next by thread: Re: Decouple SQL queries from class in OOP design
- Index(es):
Relevant Pages
|