File: mu_trig_trgfile.c

package info (click to toggle)
fis-gtm 6.2-000-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 30,784 kB
  • ctags: 42,554
  • sloc: ansic: 358,483; asm: 4,847; csh: 4,574; sh: 2,261; awk: 200; makefile: 86; sed: 13
file content (59 lines) | stat: -rw-r--r-- 2,287 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/****************************************************************
 *								*
 *	Copyright 2010 Fidelity Information Services, Inc	*
 *								*
 *	This source code contains the intellectual property	*
 *	of its copyright holder(s), and is made available	*
 *	under a license.  If you do not know the terms of	*
 *	the license, please stop and do not read further.	*
 *								*
 ****************************************************************/

#include "mdef.h"

#include "gdsroot.h"
#include "gtm_string.h"
#include "cli.h"
#include <rtnhdr.h>
#include "mu_gv_stack_init.h"
#include "trigger_trgfile_protos.h"
#include "mu_trig_trgfile.h"
#include "mupip_exit.h"

GBLREF	boolean_t		skip_dbtriggers;	/* see gbldefs.c for description of this global */
GBLREF	IN_PARMS		*cli_lex_in_ptr;
GBLREF	boolean_t		is_replicator;
GBLREF	int			tprestart_state;

void mu_trig_trgfile(char *trigger_filename, int trigger_filename_len, boolean_t noprompt)
{
	IN_PARMS		*cli_lex_in_ptr_save = NULL;
	boolean_t		trigger_error;

	error_def(ERR_MUNOACTION);

	is_replicator = TRUE;
	/* Since ^#t global is the ONLY global that is touched by MUPIP TRIGGERS and we currently dont support triggers
	 * on ^#t global, it is safe to set skip_dbtriggers to TRUE for this process. This is in fact needed so we
	 * skip cdb_sc_triggermod processing in t_end and tp_tend as otherwise that could cause unnecessary restarts in
	 * journal recovery and update process which at least the former is not designed to handle.
	 */
	skip_dbtriggers = TRUE;
	mu_gv_stack_init();
	if (NULL != cli_lex_in_ptr)
	{
		cli_lex_in_ptr_save = (IN_PARMS *)malloc(SIZEOF(IN_PARMS) + cli_lex_in_ptr->buflen);
		cli_lex_in_ptr_save->argc = cli_lex_in_ptr->argc;
		cli_lex_in_ptr_save->argv = cli_lex_in_ptr->argv;
		cli_lex_in_ptr_save->tp = cli_lex_in_ptr_save->in_str + (cli_lex_in_ptr->tp - cli_lex_in_ptr->in_str);
		cli_lex_in_ptr_save->buflen = cli_lex_in_ptr->buflen;
		memcpy(cli_lex_in_ptr_save->in_str, cli_lex_in_ptr->in_str, cli_lex_in_ptr->buflen);
	} else
		cli_lex_in_ptr_save = NULL;
	trigger_error = trigger_trgfile_tpwrap(trigger_filename, trigger_filename_len, noprompt);
	if (NULL != cli_lex_in_ptr)
		free(cli_lex_in_ptr);
	cli_lex_in_ptr = cli_lex_in_ptr_save;
	if (trigger_error)
		mupip_exit(ERR_MUNOACTION);
}