Subject Re: [firebird-support] Limiting the rows user can see
Author Dimitry Sibiryakov
On 18 Jan 2006 at 17:14, ainpoissee wrote:

>but I have feeling that this is not the best way to do it... wht do
>you think? any suggestions?

I would use Stored Procedure with something like this inside:

....
SELECT AYksLPK FROM SYS_TAP_Users
WHERE UserName=CURRENT_USER INTO :AYksLPK;

IF(AYksLPK = 3) THEN
FOR SELECT ... FROM TAB_Allyksus INTO ... DO
SUSPEND;
ELSE IF(AYksLPK > 0) THEN
FOR SELECT ... FROM TAB_Allyksus
JOIN SYS_UsrR_Allyksus ON (UserID = STU.UID) AND
(SYS_UsrR_Allyksus.Allyksus = TAY.UID) INTO ... DO
SUSPEND;
....

Should be faster than subselect with EXISTS.

--
SY, Dimitry Sibiryakov.