Re: Decouple SQL queries from class in OOP design



On 21 Nov 2005 10:43:27 -0800, "Mikito Harakiri"
<mikharakiri_nospaum@xxxxxxxxx> wrote:
>boolean isValidEmployee( int empNo ) {
> //wrap around "select count(*) from emp where emp# = :empNo"
>}
>
>OK, boolean more realistically is a record with picture, first and last
>names fields, but I digress. Tell me a single reason why this SQL query
>shouldn't be embedded in this function.

Fine by me.

Many places seek to decouple things further at the database end by
wrapping all SQL in stored procedures.

Which brings up another issue. Would your code snippet be from the
client tier or the middle tier? Judgements might be different
depending.

J.



.