Thread: Re: database abstraction -> functions

Re: database abstraction -> functions

From
Dmitry Tkach
Date:
Jeroen Olthof wrote:
> Hi,
>
> When developing applications is a good thing to create abstraction between
> different layers
> The one concerning the database would be the persistence layer. To create
> such abstraction I want all mij datababase activitie runned through
> functions. But how can I return a set of rows instead of a single datatype
> (I looked into the setof but never found a clear simple)?
>

A very simple answer - there is no way to do what you want :-(
They promise to have it in 7.3...

I am using a workaround, where my functions glue all the columns together into a pipe-separated
line, that I then parse back into columns in my application...

Also, note that, unless your functions are in C (anything like plpgsql, or just sql), they are slow like hell...
In that case, you are much better off implementing your abstraction layer through views...

Dima