From: | "adm" <adm(at)yantel(dot)ru> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Please help me!!! |
Date: | 2002-03-11 10:20:53 |
Message-ID: | a6i0dt$ldm$1@jupiter.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I need a help. I'm new in PL programming.
I need a following.
I have tables:
1) users
username|balance
2) tariff
planname|dayprice|nightprice
there are day prices and night prices
3) timeplan
planname|dstarttime|dstoptime|nstarttime|nstoptime
there are a time when dayprice, nightprice begins and stops to work.
I need to create a value "session-timeout" according to users balance that
is obatained as follows:
session-timeout=balance/price*3600 (in seconds, prices per hour)
the price must be chosen according to time of day.
and session-timeout must be calculated until the balance become 0 or below
zero.
for example:
the connection began in 6.00, the next timeborder is 9.00, we have a 3 hour
time working with a price 2c per hour,
and the next 12 hours we work with 4c per hour (in time range 9.00-21.00).
The balance must be changinhg like this
balance=balance-3hours*price (for this moment price is 2c)
and we must control to not let the user run over his balance. WE must each
time check whether user can continue working in this timerange or not.
With best reagrds, Dinar
From | Date | Subject | |
---|---|---|---|
Next Message | Fernando Lozano | 2002-03-11 12:05:00 | Re: FREE ERD TOOL for POSTGRES ??? |
Previous Message | Jacob Vennervald Madsen | 2002-03-11 10:18:01 | How can I see which users are connected? |