-- @@@ START COPYRIGHT @@@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements.  See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership.  The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License.  You may obtain a copy of the License at
--
--   http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied.  See the License for the
-- specific language governing permissions and limitations
-- under the License.
--
-- @@@ END COPYRIGHT @@@
-- EMBEDDED SQL/C test w/ Triggers on Update
-- runs on cat1.SCHM only
----------------------------------------

-- clean_up on all schemas
set schema CAT1.SCHM;
obey TEST_14_3(clean_up);
obey TEST_14_3(set_up);

-- start logging
log   LOG_14_3 clear;

set schema CAT1.SCHM;
obey TEST_14_3(tests);

log;

delete from tab1a;
delete from tab1b;
delete from cat3.schm.tab3a;
obey emb-env.sql;

log   LOG_14_3;
alter trigger disable trig3;
obey TEST_14_3(tests);


-- end logging
LOG;

-- cleanup 
obey TEST_14_3(clean_up);

exit;
----------------------------------------

?section clean_up
-------------------
SET SCHEMA cat1.schm;

obey clear.sql;

sh rm -f etest_14_3.cpp etest_14_3.exe etest_14_3.ilk etest_14_3.obj etest_14_3.pdb etest_14_3.lst etest_14_3.m;

?section set_up
-------------------

obey emb-env.sql;

-- define the triger

SET SCHEMA cat1.schm;


CREATE TRIGGER trig3
AFTER UPDATE
ON tab1A
INSERT INTO cat3.schm.tab3A (SELECT a, c FROM tab1A WHERE a=c);



-- make the executable

-- sh sh ./make-emb etest_14_3 | tee -a LOG_14_3;
sh sh ./makefileall.ksh etest_14_3 ${mxcmpdir} ${mxcidir} 2>&1;

?section tests
-------------------

log   LOG_14_3;
sh ./etest_14_3.exe | tee -a LOG_14_3;

