Subject | Re: [firebird-support] hiding some records |
---|---|
Author | Milan Babuskov |
Post date | 2008-07-29T14:10:14Z |
Sergio H. Gonzalez wrote:
table so I can configure 'visibility' globally, or for each user. Example:
CREATE TABLE user_vision (
user_name char(8),
visible smallint -- 0 or 1
)
CREATE VIEW user_view (...)
AS
SELECT t1...
FROM table1 t1
JOIN user_vision uv ON uv.user_name = current_user
WHERE t1.active = 'Y' or uv.visible = 1;
This way I can always select from USER_VIEW and not have to be careful
which table/view will I use.
Well, just this idea. I hope you find it useful.
--
Milan Babuskov
http://www.flamerobin.org
http://www.guacosoft.com
> Hello, I use FB2.1. Is there any way to hide (at database level) some recordsFor stuff like this I use views and have a flag field in a separate
> from a table. I have a quite simple scenario: selling articles marked as
> "inactive articles" And the use can choose wheter to see them or not. So far in
> every query I have for the articles table I do *WHERE ACTIVE = 'Y'* The problem
> is that in some forms I keep forgetting to add this clause and sometimes the
> inactive articles appear even if they are "hidden" in my app. So I was wandering
> if there is some way to filter that records in the database level. Something
> like adding *WHERE ACTIVE = 'Y'* to every select I perform to the article's
> table...
table so I can configure 'visibility' globally, or for each user. Example:
CREATE TABLE user_vision (
user_name char(8),
visible smallint -- 0 or 1
)
CREATE VIEW user_view (...)
AS
SELECT t1...
FROM table1 t1
JOIN user_vision uv ON uv.user_name = current_user
WHERE t1.active = 'Y' or uv.visible = 1;
This way I can always select from USER_VIEW and not have to be careful
which table/view will I use.
Well, just this idea. I hope you find it useful.
--
Milan Babuskov
http://www.flamerobin.org
http://www.guacosoft.com