Subject Re: [firebird-support] Re: Stored procedure to work with specified table/fields?
Author Helen Borrie
At 12:52 AM 19/06/2004 +0000, you wrote:
>--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
>wrote:
>
> > >I
> > >need to write a series of stored procedures to work against
> > >temporary tables that are created and dropped on the fly so the
> > >table names won't be known until runtime.
> >
> > This is *not* a recommended technique. Create "permanent"
>temporary tables
> > and implement a session ID using a generator. You can housekeep
>these
> > tables at idle times...
> >
> > /heLen
>
>I'm all ears for a better way. I started out with permanent
>temporary tables but couldn't figure out the multi user issues.
>Apparently, a session ID would resolve this. Where can I learn more
>about this technique? What happens when more than one user needs to
>run the same operation?

Think "sets" not tables. (Even a materialised temporary table is nothing
but a set, from the application's POV...)

When each user starts a "session" on a permtemptable, generate a session id
that the application will use to tag the rows it both inserts and operates
on. Multi-users are no problem - others can be inserting and operating on
rows with session ids unique to them. Their rows will never conflict. Each
user's "temporary table" is a **set** defined by ...where...whatever...and
SessionID = :MySessionID.

/heLen