Please help me!!!

Поиск
Список
Период
Сортировка
От adm
Тема Please help me!!!
Дата
Msg-id a6i0dt$ldm$1@jupiter.hub.org
обсуждение исходный текст
Список 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






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

Предыдущее
От: Mike Schroepfer
Дата:
Сообщение: Primary Key Column Size?
Следующее
От: andrew.clark@sge.net
Дата:
Сообщение: Re: Have problems with 7.1 -> 7.2 upgrade