At 12:54 26/07/99 +0400, Oleg Bartunov wrote:
>Andreas,
>
>I rewrote my function but got a problem how to know if update fails:
>
>CREATE FUNCTION "acc_hits" (int4) RETURNS datetime AS '
>Declare
> keyval Alias For $1;
> cnt int4;
> curtime datetime;
>Begin
> curtime := ''now'';
> Update hits set count = count + 1,last_access = curtime where msg_id =
keyval;
> if Not Found then
> ??????????
You need a patch to plpgsql with adds:
GET DIAGNOSTICS SELECT PROCESSED INTO num_of_rows_affected;
where num_of_rows_affected is a local variable.
The patch is currently with Jan, who is quite busy.
> -- first_access inserted on default, last_access is NULL
> Insert Into hits (msg_id,count) values (keyval, 1);
> End If;
> return curtime;
>End;
>' LANGUAGE 'plpgsql';
>
>
>
> regards,
>
> Oleg
>
>
>
>
>
>
>On Mon, 26 Jul 1999, Zeugswetter Andreas IZ5 wrote:
>
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.C.N. 008 659 498) | /(@) ______---_
Tel: +61-03-5367 7422 | _________ \
Fax: +61-03-5367 7430 | ___________ |
Http://www.rhyme.com.au | / \| | --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/