Re: Names for temp tables
Posted in 1992
Kristjan Gaukur Kristjansson writes:
> I'm having a bit of a problem with temptables.
> I'm using temptables for storing of select-results to use further later,
> and that works just fine.
> BUT, if I want to do two things at the same time that use the same temptable
> name, and so start the 4gl program in two windows, I get a conflict between
> the temptable(s) since in both cases it gets the same owner name, and that,
> the good book says, is not allowed.
>
> Now, the question is, is there any way to connect the tablename to the
> process id. instead of the users login name? Or even give temptables
> variable names? Or any other solutions?
So you're happy to name the table according to the process id ?
How about a bit of C-code like this stuff, then ?
#include <string.h> /* for sprintf */
get_pid(n)
int n; /* dummy for 4gl */
{
char buf[21];
sprintf(buf, "%d", getpid()); /* or just return an integer */
retquote(buf);
return 1;
}
Call it as
call get_pid() returning my_pid
where my_pid is a char(20), tack on some letters at the front
(table names have to start with letters ?) and do a dynamic
create table with the string you get.
You just get to link it with your 4gl code, should be dead easy.
If you're doing this from shell, check out $$ for the process id.
If you're doing this from something else, what are you doing this
from ? :-)
> With thanks in advance,
>
> Gaukur.
>
> (gaukur@rhi.hi.is)
>
Hope that helps.
Cheers - Tony.
__________________________________________________________________________
Tony Heskett th@bnr.co.uk Voice: (+44) 279 429531 x 2637
BNR, London Road, Harlow, Essex, CM17 9NA Fax: (+44) 279 454187