Subject Re: [firebird-support] How to handle temporary tables
Author Milan Babuskov
Planles wrote:
> I have data stored in FB 1.5.2 in different tables.
> I need some calculations with data from these tables, fill one temp. table
> which I send to reporter tool to make a print out.
> At the moment I have only one table, which I use to store these calculated
> data, which is fixed created.
> If more users make their print outs at the same time, each of user needs its
> own temp. table, right ?

Not neccessarily. I usually add a OWNER field (char(8)) where I store the
username, so everyone have has it's own subset of data. To make job easier,
make the column default to current_user:

alter table temp_table add owner char(8) default current_user;

You can also create a view that does the job for you:

create view temp_view(col1, col2, col3,...)
as
select col1, col2, col3,...
from temp_table
where owner = current_user;

So user should simply use temp_view as a temporary table.

--
Milan Babuskov
http://fbexport.sourceforge.net
http://www.flamerobin.org