EssReplayTransactions

指定したトランザクションを実行(再実行)します。

構文

            ESS_FUNC_M EssReplayTransactions(hCtx, AppName, 
										DbName, ReplayDat, pSeqIds);
         
パラメータデータ型説明

hCtx

ESS_HCTX_T

ログイン・コンテキスト。

AppName

ESS_STR_T

アプリケーション名。

DbName

ESS_STR_T

データベース名。

ReplayDat

ESS_TRANSACTION_REPLAY_INP_T

入力パラメータの再実行。

pSeqIds

ESS_PSEQID_T

入力タイプがシーケンスIDの場合は、シーケンスID範囲の配列

戻り値

アクセス

呼出し元は、データベースへの管理者アクセス権を持っている必要があります。

         void ListAndReplayTransactions()
{
	ESS_FUNC_M				sts = ESS_STS_NOERR;
	ESS_USHORT_T				TimeSrc;
	ESS_TIME32_T				timestamp = 0;
	ESS_USHORT_T				listOption;
	ESS_STR_T					FileName = ESS_NULL;
	ESS_ULONG_T				Count = 0;
	ESS_PTRANSACTION_ENTRY_T	pResults;
	ESS_CHAR_T				listTime[ESS_TIMESIZE];
	ESS_TRANSACTION_REPLAY_INP_T	ReplayDat;
	ESS_PSEQID_T				pSeqIds = ESS_NULL;
	ESS_OBJDEF_T				Data;
	ESS_STR_T					Script;
	ESS_SHORT_T				isAbortOnError;
	ESS_PMBRERR_T			pMbrErr = NULL;
	ESS_PROCSTATE_T		pState;

	/* Load data from server */
	Data.hCtx      = hCtx;
	Data.AppName   = AppName;
	Data.DbName    = DbName;
	Data.ObjType   = ESS_OBJTYPE_TEXT;
	Data.FileName  = "Calcdat";
	isAbortOnError = ESS_TRUE;
	sts = EssImport (hCtx, ESS_NULL, &Data, 
								&pMbrErr, NULL, isAbortOnError);
	printf("EssImport sts: %ld\r\n",sts);

	/* List and replay with a specified time */
	TimeSrc = 1;
	strcpy(listTime, "09/18/2007:00:00:00");  
							/* mm/dd/yyyy:hh:mm:ss */
	timestamp = adtGenericGetTime(listTime);
	listOption = ESS_LIST_TRANSACTIONS_TOCLIENT;
	sts = EssListTransactions(hCtx, TimeSrc, 
												timestamp, listOption, 
												FileName, &Count, &pResults);
		/* This function converts listTime to the number of 
			seconds since January 1, 1970. */
	printf("EssListTransactions sts: %ld\r\n",sts);
	if (Count && pResults)
		PrintTransactionLog(Count, pResults);

	memset(&ReplayDat, 0, sizeof 
								(ESS_TRANSACTION_REPLAY_INP_T));
	ReplayDat.InpType = ESS_REPLAY_BASED_GIVENTIME;
	ReplayDat.value.InpTime = timestamp;
	sts = 
         EssReplayTransactions (hCtx, AppName, DbName, 
													ReplayDat, pSeqIds);
         
	printf("EssReplayTransactions sts: %ld\r\n",sts);
	printf("\n\n");

	/* Run a calc*/
	Script = "CALC ALL;";
	sts = EssCalc(hCtx, ESS_TRUE, Script);
	printf("EssCalc sts: %ld\r\n",sts);
	if (!sts)
	{
		sts = EssGetProcessState (hCtx, &pState);
		while (!sts && (pState.State != ESS_STATE_DONE))
			sts = EssGetProcessState (hCtx, &pState);
	}

	/* List and replay with last replay time */
	TimeSrc = 2;
	timestamp = 0;
	sts = EssListTransactions(hCtx, TimeSrc, 
											timestamp, listOption, 
											FileName, &Count, &pResults);
		/* This function converts listTime to the number of 
			seconds since January 1, 1970. */
	printf("EssListTransactions sts: %ld\r\n",sts);
	if (Count && pResults)
		PrintTransactionLog(Count, pResults);
	memset(&ReplayDat, 0, sizeof 
							(ESS_TRANSACTION_REPLAY_INP_T));
	ReplayDat.InpType = ESS_REPLAY_BASED_LASTREPLAYTIME;
	sts = 
         EssReplayTransactions (hCtx, AppName, 
						DbName, ReplayDat, pSeqIds);

         
	printf("EssReplayTransactions sts: %ld\r\n",sts);

	if(pSeqIds)
		EssFree(hInst, pSeqIds);
	if(pResults)
		EssFree(hInst, pResults);
	if(pMbrErr)
		EssFree(hInst, pMbrErr);
}
      

Using SeqIds

シーケンスID配列を使用して再実行する場合、シーケンスIDの範囲を指定します。

例1: 1-5、8-10、12-16の範囲を6、7、および11をスキップして再実行する場合:

         num_seq_id_range = 3
seqid_array[0].seq_id_start = 1
seqid_array[0].seq_id_end = 5
seqid_array[0].seq_id_start_upper = 0
seqid_array[0].seq_id_end_upper = 0
seqid_array[1].seq_id_start = 8
seqid_array[1].seq_id_end = 10
seqid_array[1].seq_id_start_upper = 0
seqid_array[1].seq_id_end_upper = 0
seqid_array[2].seq_id_start = 12
seqid_array[2].seq_id_end = 16
seqid_array[2].seq_id_start_upper = 0
seqid_array[2].seq_id_end_upper = 0
      

例2: 3-7の範囲のみを再実行する場合は、num_seq_id_range = 1:

         seqid_array[0].seq_id_start = 3
seqid_array[0].seq_id_end = 7
seqid_array[0].seq_id_start_upper = 0
seqid_array[0].seq_id_end_upper = 0
      

例3: トランザクションIDの5を再実行する場合:

         num_seq_id_range = 1
seqid_array[0].seq_id_start = 5
seqid_array[0].seq_id_end = 5
seqid_array[0].seq_id_start_upper = 0
seqid_array[0].seq_id_end_upper = 0
      

関連トピック