Обсуждение: Converting a function in C

Поиск
Список
Период
Сортировка

Converting a function in C

От
Mr OCP
Дата:
Hi

Can any one please help me write the following triger
in C, your help would be much appreciated

/* Archive function */
  DROP FUNCTION fn_archive();
  CREATE FUNCTION fn_archive() RETURNS OPAQUE AS '
    BEGIN
      /* TG_OP is the function (UPDATE, DELETE,
SELECT) */
      INSERT INTO adres_archive
          VALUES
(OLD.name,OLD.adres,OLD.tel,current_user,now(),TG_OP);

      IF TG_OP = ''UPDATE''
      THEN
        NEW.modtime := ''now'';
        RETURN NEW;
      END IF;

      RETURN OLD;
    END;
  ' LANGUAGE 'plpgsql';



Tks
Mike

http://shopping.yahoo.com.au - Yahoo! Shopping
- Get organised for Christmas early this year!