My First Function

Поиск
Список
Период
Сортировка
От Gary Stainburn
Тема My First Function
Дата
Msg-id 01070116300703.07831@gary.ringways.co.uk
обсуждение исходный текст
Список pgsql-sql
Hi all,

Background
To date I've been using perl and DBI/DBD:Pg.  I've done everything except SQL 
stuff in perl and done okay(ish).

I'm just about to teach myself PHP before starting a new project, and have in 
front of me a problem.  A number of perl subs that I've used in the past will 
now need porting to PHP. Any new routines would need to to written in both.

Thus, I've decided to also learn plsql in an attempt reduce my workload.  As 
I work best from examples and tutorials than I do from manuals, I was 
wondering if some kind sole would write my first function for me. (This task 
is a little extreme, basically what I will need)

The function I want is to provide access control to functions I will be 
writing on a web site for  REVCOM, a UK Charity.  The idea is that I have 
members who may hold positions on the management committee.  There is a 
many-to-many relationship between positions and members.  Access to functions 
is dependant on the position held by a member.  For example, the treasurer 
can update the accounts, the secretary can view the accounts.  If both 
positions are held by the same person then the treasurer's rights should be 
returned for that function.  The result should be an integer where -1 = no 
access, or a +ID gives increasing permissions.

I want to be able to pass a member ID and a function ID and return the 
highest permission for the two.  The cut-down schema is:

Members table        holds member details
MID int4 (Primary key)    member ID

Functions table         holds function details
FID int4 (Primary key)     function ID

Positions table        Holds Comittee Position details
PID int4 (Primary key)    Position ID

Holder table        Relationship between members and positions
HMID int4        Position holding member's ID
HPID int4        Position ID

Permissions table    Relationship between functions and committee positions
PFID int4        Function ID
PPID int4        Position ID
PPERM            permission level

I understand that this is a biggie, but I thought if I could understand how 
this worked, I could learn much from it.
-- 
Gary Stainburn
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     


В списке pgsql-sql по дате отправления:

Предыдущее
От: joe.celko@trilogy.com (--CELKO--)
Дата:
Сообщение: Re: Help!!! Trying to "SELECT" and get a tree structure back.
Следующее
От: "omid omoomi"
Дата:
Сообщение: Re: My First Function