Changes between Version 75 and Version 76 of AdvancedApplicationDevelopment


Ignore:
Timestamp:
08/31/24 13:53:14 (3 months ago)
Author:
184006
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdvancedApplicationDevelopment

    v75 v76  
    179179
    180180}}}
     181\\ При внес на dateending во Pet Cares се проверува дали е после startdate. Доколку не е полето dateending се пополнува со иста вредност како startdate.
     182{{{
     183CREATE OR REPLACE FUNCTION set_start_date()
     184RETURNS TRIGGER AS $$
     185BEGIN
     186    IF NEW.start_date IS NULL OR NEW.start_date <> NEW.dateending THEN
     187        NEW.start_date := NEW.dateending;
     188    END IF;
     189    RETURN NEW;
     190END;
     191$$ LANGUAGE plpgsql;
     192
     193
     194CREATE TRIGGER set_start_date_trigger
     195BEFORE INSERT OR UPDATE ON pet_cares
     196FOR EACH ROW
     197EXECUTE FUNCTION set_start_date();
     198}}}