Re: database abstraction -> functions - Mailing list pgsql-sql

From Dmitry Tkach
Subject Re: database abstraction -> functions
Date
Msg-id 3D91C22A.2060500@openratings.com
Whole thread Raw
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Manfred Koizar
Date:
Subject: Re: [GENERAL] CURRENT_TIMESTAMP
Next
From: Dmitry Tkach
Date:
Subject: Re: Is there a better way than this to get the start and end of a month?